/**********************************************************************************************************************
 * The contents of this file are subject to the SugarCRM Public License Version 1.1.3 ("License"); You may not use this
 * file except in compliance with the License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
 * express or implied.  See the License for the specific language governing rights and limitations under the License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 *    (iii) the SplendidCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for requirements.
 *
 * The Original Code is: SplendidCRM Open Source
 * The Initial Developer of the Original Code is SplendidCRM Software, Inc.
 * Portions created by SplendidCRM Software are Copyright (C) 2005 SplendidCRM Software, Inc. All Rights Reserved.
 * Contributor(s): ______________________________________.
 *********************************************************************************************************************/
using System;
using System.Data;
using System.Data.Common;
//using Microsoft.VisualBasic;
using System.Xml;

namespace SplendidCRM
{
	/// <summary>
	/// SqlProcs generated on 1/27/2008 1:28:00 AM
	/// </summary>
	public class SqlProcs
	{

		#region spACCOUNTS_BUGS_Delete
		/// <summary>
		/// spACCOUNTS_BUGS_Delete
		/// </summary>
		public static void spACCOUNTS_BUGS_Delete(Guid gACCOUNT_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_BUGS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_BUGS_Delete
		/// <summary>
		/// spACCOUNTS_BUGS_Delete
		/// </summary>
		public static void spACCOUNTS_BUGS_Delete(Guid gACCOUNT_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_BUGS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_BUGS_Delete
		/// <summary>
		/// spACCOUNTS_BUGS_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_BUGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_BUGS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_BUGS_Update
		/// <summary>
		/// spACCOUNTS_BUGS_Update
		/// </summary>
		public static void spACCOUNTS_BUGS_Update(Guid gACCOUNT_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_BUGS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_BUGS_Update
		/// <summary>
		/// spACCOUNTS_BUGS_Update
		/// </summary>
		public static void spACCOUNTS_BUGS_Update(Guid gACCOUNT_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_BUGS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_BUGS_Update
		/// <summary>
		/// spACCOUNTS_BUGS_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_BUGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_BUGS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_CASES_Delete
		/// <summary>
		/// spACCOUNTS_CASES_Delete
		/// </summary>
		public static void spACCOUNTS_CASES_Delete(Guid gACCOUNT_ID, Guid gCASE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_CASES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_CASES_Delete
		/// <summary>
		/// spACCOUNTS_CASES_Delete
		/// </summary>
		public static void spACCOUNTS_CASES_Delete(Guid gACCOUNT_ID, Guid gCASE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_CASES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_CASES_Delete
		/// <summary>
		/// spACCOUNTS_CASES_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_CASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_CASES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_CASES_Update
		/// <summary>
		/// spACCOUNTS_CASES_Update
		/// </summary>
		public static void spACCOUNTS_CASES_Update(Guid gACCOUNT_ID, Guid gCASE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_CASES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_CASES_Update
		/// <summary>
		/// spACCOUNTS_CASES_Update
		/// </summary>
		public static void spACCOUNTS_CASES_Update(Guid gACCOUNT_ID, Guid gCASE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_CASES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_CASES_Update
		/// <summary>
		/// spACCOUNTS_CASES_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_CASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_CASES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_CONTACTS_Delete
		/// <summary>
		/// spACCOUNTS_CONTACTS_Delete
		/// </summary>
		public static void spACCOUNTS_CONTACTS_Delete(Guid gACCOUNT_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_CONTACTS_Delete
		/// <summary>
		/// spACCOUNTS_CONTACTS_Delete
		/// </summary>
		public static void spACCOUNTS_CONTACTS_Delete(Guid gACCOUNT_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_CONTACTS_Delete
		/// <summary>
		/// spACCOUNTS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_CONTACTS_Update
		/// <summary>
		/// spACCOUNTS_CONTACTS_Update
		/// </summary>
		public static void spACCOUNTS_CONTACTS_Update(Guid gACCOUNT_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_CONTACTS_Update
		/// <summary>
		/// spACCOUNTS_CONTACTS_Update
		/// </summary>
		public static void spACCOUNTS_CONTACTS_Update(Guid gACCOUNT_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_CONTACTS_Update
		/// <summary>
		/// spACCOUNTS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_Delete
		/// <summary>
		/// spACCOUNTS_Delete
		/// </summary>
		public static void spACCOUNTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_Delete
		/// <summary>
		/// spACCOUNTS_Delete
		/// </summary>
		public static void spACCOUNTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_Delete
		/// <summary>
		/// spACCOUNTS_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_MassDelete
		/// <summary>
		/// spACCOUNTS_MassDelete
		/// </summary>
		public static void spACCOUNTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_MassDelete
		/// <summary>
		/// spACCOUNTS_MassDelete
		/// </summary>
		public static void spACCOUNTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_MassDelete
		/// <summary>
		/// spACCOUNTS_MassDelete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_MassUpdate
		/// <summary>
		/// spACCOUNTS_MassUpdate
		/// </summary>
		public static void spACCOUNTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sACCOUNT_TYPE, string sINDUSTRY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parACCOUNT_TYPE     = Sql.AddParameter(cmd, "@ACCOUNT_TYPE"    , sACCOUNT_TYPE      ,  25);
							IDbDataParameter parINDUSTRY         = Sql.AddParameter(cmd, "@INDUSTRY"        , sINDUSTRY          ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_MassUpdate
		/// <summary>
		/// spACCOUNTS_MassUpdate
		/// </summary>
		public static void spACCOUNTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sACCOUNT_TYPE, string sINDUSTRY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parACCOUNT_TYPE     = Sql.AddParameter(cmd, "@ACCOUNT_TYPE"    , sACCOUNT_TYPE      ,  25);
				IDbDataParameter parINDUSTRY         = Sql.AddParameter(cmd, "@INDUSTRY"        , sINDUSTRY          ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_MassUpdate
		/// <summary>
		/// spACCOUNTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdACCOUNTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_TYPE     = Sql.CreateParameter(cmd, "@ACCOUNT_TYPE"    , "string",  25);
			IDbDataParameter parINDUSTRY         = Sql.CreateParameter(cmd, "@INDUSTRY"        , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_New
		/// <summary>
		/// spACCOUNTS_New
		/// </summary>
		public static void spACCOUNTS_New(ref Guid gID, string sNAME, string sPHONE_OFFICE, string sWEBSITE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parPHONE_OFFICE     = Sql.AddParameter(cmd, "@PHONE_OFFICE"    , sPHONE_OFFICE      ,  25);
							IDbDataParameter parWEBSITE          = Sql.AddParameter(cmd, "@WEBSITE"         , sWEBSITE           , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_New
		/// <summary>
		/// spACCOUNTS_New
		/// </summary>
		public static void spACCOUNTS_New(ref Guid gID, string sNAME, string sPHONE_OFFICE, string sWEBSITE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parPHONE_OFFICE     = Sql.AddParameter(cmd, "@PHONE_OFFICE"    , sPHONE_OFFICE      ,  25);
				IDbDataParameter parWEBSITE          = Sql.AddParameter(cmd, "@WEBSITE"         , sWEBSITE           , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdACCOUNTS_New
		/// <summary>
		/// spACCOUNTS_New
		/// </summary>
		public static IDbCommand cmdACCOUNTS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parPHONE_OFFICE     = Sql.CreateParameter(cmd, "@PHONE_OFFICE"    , "string",  25);
			IDbDataParameter parWEBSITE          = Sql.CreateParameter(cmd, "@WEBSITE"         , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spACCOUNTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spACCOUNTS_OPPORTUNITIES_Delete(Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delet";
							else
								cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spACCOUNTS_OPPORTUNITIES_Delete(Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delet";
				else
					cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delet";
			else
				cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_OPPORTUNITIES_Update
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spACCOUNTS_OPPORTUNITIES_Update(Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Updat";
							else
								cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_OPPORTUNITIES_Update
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spACCOUNTS_OPPORTUNITIES_Update(Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Updat";
				else
					cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_OPPORTUNITIES_Update
		/// <summary>
		/// spACCOUNTS_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Updat";
			else
				cmd.CommandText = "spACCOUNTS_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_PARENT_Update
		/// <summary>
		/// spACCOUNTS_PARENT_Update
		/// </summary>
		public static void spACCOUNTS_PARENT_Update(Guid gACCOUNT_ID, Guid gPARENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_PARENT_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_PARENT_Update
		/// <summary>
		/// spACCOUNTS_PARENT_Update
		/// </summary>
		public static void spACCOUNTS_PARENT_Update(Guid gACCOUNT_ID, Guid gPARENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_PARENT_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_PARENT_Update
		/// <summary>
		/// spACCOUNTS_PARENT_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_PARENT_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_PARENT_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_QUOTES_Delete
		/// <summary>
		/// spACCOUNTS_QUOTES_Delete
		/// </summary>
		public static void spACCOUNTS_QUOTES_Delete(Guid gACCOUNT_ID, Guid gQUOTE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_QUOTES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_QUOTES_Delete
		/// <summary>
		/// spACCOUNTS_QUOTES_Delete
		/// </summary>
		public static void spACCOUNTS_QUOTES_Delete(Guid gACCOUNT_ID, Guid gQUOTE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_QUOTES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_QUOTES_Delete
		/// <summary>
		/// spACCOUNTS_QUOTES_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_QUOTES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_QUOTES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_THREADS_Delete
		/// <summary>
		/// spACCOUNTS_THREADS_Delete
		/// </summary>
		public static void spACCOUNTS_THREADS_Delete(Guid gACCOUNT_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_THREADS_Delete
		/// <summary>
		/// spACCOUNTS_THREADS_Delete
		/// </summary>
		public static void spACCOUNTS_THREADS_Delete(Guid gACCOUNT_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_THREADS_Delete
		/// <summary>
		/// spACCOUNTS_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdACCOUNTS_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_THREADS_Update
		/// <summary>
		/// spACCOUNTS_THREADS_Update
		/// </summary>
		public static void spACCOUNTS_THREADS_Update(Guid gACCOUNT_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_THREADS_Update
		/// <summary>
		/// spACCOUNTS_THREADS_Update
		/// </summary>
		public static void spACCOUNTS_THREADS_Update(Guid gACCOUNT_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACCOUNTS_THREADS_Update
		/// <summary>
		/// spACCOUNTS_THREADS_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACCOUNTS_Update
		/// <summary>
		/// spACCOUNTS_Update
		/// </summary>
		public static void spACCOUNTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sACCOUNT_TYPE, Guid gPARENT_ID, string sINDUSTRY, string sANNUAL_REVENUE, string sPHONE_FAX, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, string sDESCRIPTION, string sRATING, string sPHONE_OFFICE, string sPHONE_ALTERNATE, string sEMAIL1, string sEMAIL2, string sWEBSITE, string sOWNERSHIP, string sEMPLOYEES, string sSIC_CODE, string sTICKER_SYMBOL, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACCOUNTS_Update";
							IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
							IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
							IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
							IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         , 150);
							IDbDataParameter parACCOUNT_TYPE                = Sql.AddParameter(cmd, "@ACCOUNT_TYPE"               , sACCOUNT_TYPE                 ,  25);
							IDbDataParameter parPARENT_ID                   = Sql.AddParameter(cmd, "@PARENT_ID"                  , gPARENT_ID                    );
							IDbDataParameter parINDUSTRY                    = Sql.AddParameter(cmd, "@INDUSTRY"                   , sINDUSTRY                     ,  25);
							IDbDataParameter parANNUAL_REVENUE              = Sql.AddParameter(cmd, "@ANNUAL_REVENUE"             , sANNUAL_REVENUE               ,  25);
							IDbDataParameter parPHONE_FAX                   = Sql.AddParameter(cmd, "@PHONE_FAX"                  , sPHONE_FAX                    ,  25);
							IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
							IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
							IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
							IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
							IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
							IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
							IDbDataParameter parRATING                      = Sql.AddParameter(cmd, "@RATING"                     , sRATING                       ,  25);
							IDbDataParameter parPHONE_OFFICE                = Sql.AddParameter(cmd, "@PHONE_OFFICE"               , sPHONE_OFFICE                 ,  25);
							IDbDataParameter parPHONE_ALTERNATE             = Sql.AddParameter(cmd, "@PHONE_ALTERNATE"            , sPHONE_ALTERNATE              ,  25);
							IDbDataParameter parEMAIL1                      = Sql.AddParameter(cmd, "@EMAIL1"                     , sEMAIL1                       , 100);
							IDbDataParameter parEMAIL2                      = Sql.AddParameter(cmd, "@EMAIL2"                     , sEMAIL2                       , 100);
							IDbDataParameter parWEBSITE                     = Sql.AddParameter(cmd, "@WEBSITE"                    , sWEBSITE                      , 255);
							IDbDataParameter parOWNERSHIP                   = Sql.AddParameter(cmd, "@OWNERSHIP"                  , sOWNERSHIP                    , 100);
							IDbDataParameter parEMPLOYEES                   = Sql.AddParameter(cmd, "@EMPLOYEES"                  , sEMPLOYEES                    ,  10);
							IDbDataParameter parSIC_CODE                    = Sql.AddParameter(cmd, "@SIC_CODE"                   , sSIC_CODE                     ,  10);
							IDbDataParameter parTICKER_SYMBOL               = Sql.AddParameter(cmd, "@TICKER_SYMBOL"              , sTICKER_SYMBOL                ,  10);
							IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
							IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
							IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
							IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACCOUNTS_Update
		/// <summary>
		/// spACCOUNTS_Update
		/// </summary>
		public static void spACCOUNTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sACCOUNT_TYPE, Guid gPARENT_ID, string sINDUSTRY, string sANNUAL_REVENUE, string sPHONE_FAX, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, string sDESCRIPTION, string sRATING, string sPHONE_OFFICE, string sPHONE_ALTERNATE, string sEMAIL1, string sEMAIL2, string sWEBSITE, string sOWNERSHIP, string sEMPLOYEES, string sSIC_CODE, string sTICKER_SYMBOL, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACCOUNTS_Update";
				IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
				IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
				IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
				IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         , 150);
				IDbDataParameter parACCOUNT_TYPE                = Sql.AddParameter(cmd, "@ACCOUNT_TYPE"               , sACCOUNT_TYPE                 ,  25);
				IDbDataParameter parPARENT_ID                   = Sql.AddParameter(cmd, "@PARENT_ID"                  , gPARENT_ID                    );
				IDbDataParameter parINDUSTRY                    = Sql.AddParameter(cmd, "@INDUSTRY"                   , sINDUSTRY                     ,  25);
				IDbDataParameter parANNUAL_REVENUE              = Sql.AddParameter(cmd, "@ANNUAL_REVENUE"             , sANNUAL_REVENUE               ,  25);
				IDbDataParameter parPHONE_FAX                   = Sql.AddParameter(cmd, "@PHONE_FAX"                  , sPHONE_FAX                    ,  25);
				IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
				IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
				IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
				IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
				IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
				IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
				IDbDataParameter parRATING                      = Sql.AddParameter(cmd, "@RATING"                     , sRATING                       ,  25);
				IDbDataParameter parPHONE_OFFICE                = Sql.AddParameter(cmd, "@PHONE_OFFICE"               , sPHONE_OFFICE                 ,  25);
				IDbDataParameter parPHONE_ALTERNATE             = Sql.AddParameter(cmd, "@PHONE_ALTERNATE"            , sPHONE_ALTERNATE              ,  25);
				IDbDataParameter parEMAIL1                      = Sql.AddParameter(cmd, "@EMAIL1"                     , sEMAIL1                       , 100);
				IDbDataParameter parEMAIL2                      = Sql.AddParameter(cmd, "@EMAIL2"                     , sEMAIL2                       , 100);
				IDbDataParameter parWEBSITE                     = Sql.AddParameter(cmd, "@WEBSITE"                    , sWEBSITE                      , 255);
				IDbDataParameter parOWNERSHIP                   = Sql.AddParameter(cmd, "@OWNERSHIP"                  , sOWNERSHIP                    , 100);
				IDbDataParameter parEMPLOYEES                   = Sql.AddParameter(cmd, "@EMPLOYEES"                  , sEMPLOYEES                    ,  10);
				IDbDataParameter parSIC_CODE                    = Sql.AddParameter(cmd, "@SIC_CODE"                   , sSIC_CODE                     ,  10);
				IDbDataParameter parTICKER_SYMBOL               = Sql.AddParameter(cmd, "@TICKER_SYMBOL"              , sTICKER_SYMBOL                ,  10);
				IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
				IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
				IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
				IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdACCOUNTS_Update
		/// <summary>
		/// spACCOUNTS_Update
		/// </summary>
		public static IDbCommand cmdACCOUNTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACCOUNTS_Update";
			IDbDataParameter parID                          = Sql.CreateParameter(cmd, "@ID"                         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID            = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"           , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID            = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"           , "Guid",  16);
			IDbDataParameter parNAME                        = Sql.CreateParameter(cmd, "@NAME"                       , "string", 150);
			IDbDataParameter parACCOUNT_TYPE                = Sql.CreateParameter(cmd, "@ACCOUNT_TYPE"               , "string",  25);
			IDbDataParameter parPARENT_ID                   = Sql.CreateParameter(cmd, "@PARENT_ID"                  , "Guid",  16);
			IDbDataParameter parINDUSTRY                    = Sql.CreateParameter(cmd, "@INDUSTRY"                   , "string",  25);
			IDbDataParameter parANNUAL_REVENUE              = Sql.CreateParameter(cmd, "@ANNUAL_REVENUE"             , "string",  25);
			IDbDataParameter parPHONE_FAX                   = Sql.CreateParameter(cmd, "@PHONE_FAX"                  , "string",  25);
			IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STREET"     , "string", 150);
			IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_CITY"       , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STATE"      , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , "string",  20);
			IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , "string", 100);
			IDbDataParameter parDESCRIPTION                 = Sql.CreateParameter(cmd, "@DESCRIPTION"                , "string", 104857600);
			IDbDataParameter parRATING                      = Sql.CreateParameter(cmd, "@RATING"                     , "string",  25);
			IDbDataParameter parPHONE_OFFICE                = Sql.CreateParameter(cmd, "@PHONE_OFFICE"               , "string",  25);
			IDbDataParameter parPHONE_ALTERNATE             = Sql.CreateParameter(cmd, "@PHONE_ALTERNATE"            , "string",  25);
			IDbDataParameter parEMAIL1                      = Sql.CreateParameter(cmd, "@EMAIL1"                     , "string", 100);
			IDbDataParameter parEMAIL2                      = Sql.CreateParameter(cmd, "@EMAIL2"                     , "string", 100);
			IDbDataParameter parWEBSITE                     = Sql.CreateParameter(cmd, "@WEBSITE"                    , "string", 255);
			IDbDataParameter parOWNERSHIP                   = Sql.CreateParameter(cmd, "@OWNERSHIP"                  , "string", 100);
			IDbDataParameter parEMPLOYEES                   = Sql.CreateParameter(cmd, "@EMPLOYEES"                  , "string",  10);
			IDbDataParameter parSIC_CODE                    = Sql.CreateParameter(cmd, "@SIC_CODE"                   , "string",  10);
			IDbDataParameter parTICKER_SYMBOL               = Sql.CreateParameter(cmd, "@TICKER_SYMBOL"              , "string",  10);
			IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parTEAM_ID                     = Sql.CreateParameter(cmd, "@TEAM_ID"                    , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spACL_ACTIONS_Delete
		/// <summary>
		/// spACL_ACTIONS_Delete
		/// </summary>
		public static void spACL_ACTIONS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ACTIONS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ACTIONS_Delete
		/// <summary>
		/// spACL_ACTIONS_Delete
		/// </summary>
		public static void spACL_ACTIONS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ACTIONS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ACTIONS_Delete
		/// <summary>
		/// spACL_ACTIONS_Delete
		/// </summary>
		public static IDbCommand cmdACL_ACTIONS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ACTIONS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACL_ACTIONS_Initialize
		/// <summary>
		/// spACL_ACTIONS_Initialize
		/// </summary>
		public static void spACL_ACTIONS_Initialize()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ACTIONS_Initialize";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ACTIONS_Initialize
		/// <summary>
		/// spACL_ACTIONS_Initialize
		/// </summary>
		public static void spACL_ACTIONS_Initialize(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ACTIONS_Initialize";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ACTIONS_Initialize
		/// <summary>
		/// spACL_ACTIONS_Initialize
		/// </summary>
		public static IDbCommand cmdACL_ACTIONS_Initialize(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ACTIONS_Initialize";
			return cmd;
		}
		#endregion

		#region spACL_ACTIONS_InsertOnly
		/// <summary>
		/// spACL_ACTIONS_InsertOnly
		/// </summary>
		public static void spACL_ACTIONS_InsertOnly(string sNAME, string sCATEGORY, string sACLTYPE, Int32 nACLACCESS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ACTIONS_InsertOnly";
							IDbDataParameter parNAME      = Sql.AddParameter(cmd, "@NAME"     , sNAME       , 150);
							IDbDataParameter parCATEGORY  = Sql.AddParameter(cmd, "@CATEGORY" , sCATEGORY   , 100);
							IDbDataParameter parACLTYPE   = Sql.AddParameter(cmd, "@ACLTYPE"  , sACLTYPE    , 100);
							IDbDataParameter parACLACCESS = Sql.AddParameter(cmd, "@ACLACCESS", nACLACCESS  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ACTIONS_InsertOnly
		/// <summary>
		/// spACL_ACTIONS_InsertOnly
		/// </summary>
		public static void spACL_ACTIONS_InsertOnly(string sNAME, string sCATEGORY, string sACLTYPE, Int32 nACLACCESS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ACTIONS_InsertOnly";
				IDbDataParameter parNAME      = Sql.AddParameter(cmd, "@NAME"     , sNAME       , 150);
				IDbDataParameter parCATEGORY  = Sql.AddParameter(cmd, "@CATEGORY" , sCATEGORY   , 100);
				IDbDataParameter parACLTYPE   = Sql.AddParameter(cmd, "@ACLTYPE"  , sACLTYPE    , 100);
				IDbDataParameter parACLACCESS = Sql.AddParameter(cmd, "@ACLACCESS", nACLACCESS  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ACTIONS_InsertOnly
		/// <summary>
		/// spACL_ACTIONS_InsertOnly
		/// </summary>
		public static IDbCommand cmdACL_ACTIONS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ACTIONS_InsertOnly";
			IDbDataParameter parNAME      = Sql.CreateParameter(cmd, "@NAME"     , "string", 150);
			IDbDataParameter parCATEGORY  = Sql.CreateParameter(cmd, "@CATEGORY" , "string", 100);
			IDbDataParameter parACLTYPE   = Sql.CreateParameter(cmd, "@ACLTYPE"  , "string", 100);
			IDbDataParameter parACLACCESS = Sql.CreateParameter(cmd, "@ACLACCESS", "Int32",   4);
			return cmd;
		}
		#endregion

		#region spACL_ACTIONS_Update
		/// <summary>
		/// spACL_ACTIONS_Update
		/// </summary>
		public static void spACL_ACTIONS_Update(ref Guid gID, string sNAME, string sCATEGORY, string sACLTYPE, Int32 nACLACCESS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ACTIONS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 100);
							IDbDataParameter parACLTYPE          = Sql.AddParameter(cmd, "@ACLTYPE"         , sACLTYPE           , 100);
							IDbDataParameter parACLACCESS        = Sql.AddParameter(cmd, "@ACLACCESS"       , nACLACCESS         );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ACTIONS_Update
		/// <summary>
		/// spACL_ACTIONS_Update
		/// </summary>
		public static void spACL_ACTIONS_Update(ref Guid gID, string sNAME, string sCATEGORY, string sACLTYPE, Int32 nACLACCESS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ACTIONS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 100);
				IDbDataParameter parACLTYPE          = Sql.AddParameter(cmd, "@ACLTYPE"         , sACLTYPE           , 100);
				IDbDataParameter parACLACCESS        = Sql.AddParameter(cmd, "@ACLACCESS"       , nACLACCESS         );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdACL_ACTIONS_Update
		/// <summary>
		/// spACL_ACTIONS_Update
		/// </summary>
		public static IDbCommand cmdACL_ACTIONS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ACTIONS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string", 100);
			IDbDataParameter parACLTYPE          = Sql.CreateParameter(cmd, "@ACLTYPE"         , "string", 100);
			IDbDataParameter parACLACCESS        = Sql.CreateParameter(cmd, "@ACLACCESS"       , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spACL_ROLES_ACTIONS_Delete
		/// <summary>
		/// spACL_ROLES_ACTIONS_Delete
		/// </summary>
		public static void spACL_ROLES_ACTIONS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_ACTIONS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_ACTIONS_Delete
		/// <summary>
		/// spACL_ROLES_ACTIONS_Delete
		/// </summary>
		public static void spACL_ROLES_ACTIONS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_ACTIONS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_ACTIONS_Delete
		/// <summary>
		/// spACL_ROLES_ACTIONS_Delete
		/// </summary>
		public static IDbCommand cmdACL_ROLES_ACTIONS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_ACTIONS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACL_ROLES_ACTIONS_Update
		/// <summary>
		/// spACL_ROLES_ACTIONS_Update
		/// </summary>
		public static void spACL_ROLES_ACTIONS_Update(ref Guid gID, Guid gROLE_ID, string sACTION_NAME, string sMODULE_NAME, Int32 nACCESS_OVERRIDE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_ACTIONS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parACTION_NAME      = Sql.AddParameter(cmd, "@ACTION_NAME"     , sACTION_NAME       ,  25);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parACCESS_OVERRIDE  = Sql.AddParameter(cmd, "@ACCESS_OVERRIDE" , nACCESS_OVERRIDE   );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_ACTIONS_Update
		/// <summary>
		/// spACL_ROLES_ACTIONS_Update
		/// </summary>
		public static void spACL_ROLES_ACTIONS_Update(ref Guid gID, Guid gROLE_ID, string sACTION_NAME, string sMODULE_NAME, Int32 nACCESS_OVERRIDE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_ACTIONS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parACTION_NAME      = Sql.AddParameter(cmd, "@ACTION_NAME"     , sACTION_NAME       ,  25);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parACCESS_OVERRIDE  = Sql.AddParameter(cmd, "@ACCESS_OVERRIDE" , nACCESS_OVERRIDE   );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdACL_ROLES_ACTIONS_Update
		/// <summary>
		/// spACL_ROLES_ACTIONS_Update
		/// </summary>
		public static IDbCommand cmdACL_ROLES_ACTIONS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_ACTIONS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parACTION_NAME      = Sql.CreateParameter(cmd, "@ACTION_NAME"     , "string",  25);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parACCESS_OVERRIDE  = Sql.CreateParameter(cmd, "@ACCESS_OVERRIDE" , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spACL_ROLES_Delete
		/// <summary>
		/// spACL_ROLES_Delete
		/// </summary>
		public static void spACL_ROLES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_Delete
		/// <summary>
		/// spACL_ROLES_Delete
		/// </summary>
		public static void spACL_ROLES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_Delete
		/// <summary>
		/// spACL_ROLES_Delete
		/// </summary>
		public static IDbCommand cmdACL_ROLES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACL_ROLES_MassDelete
		/// <summary>
		/// spACL_ROLES_MassDelete
		/// </summary>
		public static void spACL_ROLES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_MassDelete
		/// <summary>
		/// spACL_ROLES_MassDelete
		/// </summary>
		public static void spACL_ROLES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_MassDelete
		/// <summary>
		/// spACL_ROLES_MassDelete
		/// </summary>
		public static IDbCommand cmdACL_ROLES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACL_ROLES_Update
		/// <summary>
		/// spACL_ROLES_Update
		/// </summary>
		public static void spACL_ROLES_Update(ref Guid gID, string sNAME, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_Update
		/// <summary>
		/// spACL_ROLES_Update
		/// </summary>
		public static void spACL_ROLES_Update(ref Guid gID, string sNAME, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdACL_ROLES_Update
		/// <summary>
		/// spACL_ROLES_Update
		/// </summary>
		public static IDbCommand cmdACL_ROLES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spACL_ROLES_USERS_Delete
		/// <summary>
		/// spACL_ROLES_USERS_Delete
		/// </summary>
		public static void spACL_ROLES_USERS_Delete(Guid gROLE_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_USERS_Delete
		/// <summary>
		/// spACL_ROLES_USERS_Delete
		/// </summary>
		public static void spACL_ROLES_USERS_Delete(Guid gROLE_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_USERS_Delete
		/// <summary>
		/// spACL_ROLES_USERS_Delete
		/// </summary>
		public static IDbCommand cmdACL_ROLES_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACL_ROLES_USERS_MassUpdate
		/// <summary>
		/// spACL_ROLES_USERS_MassUpdate
		/// </summary>
		public static void spACL_ROLES_USERS_MassUpdate(Guid gROLE_ID, string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_USERS_MassUpdate";
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_USERS_MassUpdate
		/// <summary>
		/// spACL_ROLES_USERS_MassUpdate
		/// </summary>
		public static void spACL_ROLES_USERS_MassUpdate(Guid gROLE_ID, string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_USERS_MassUpdate";
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_USERS_MassUpdate
		/// <summary>
		/// spACL_ROLES_USERS_MassUpdate
		/// </summary>
		public static IDbCommand cmdACL_ROLES_USERS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_USERS_MassUpdate";
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			return cmd;
		}
		#endregion

		#region spACL_ROLES_USERS_Update
		/// <summary>
		/// spACL_ROLES_USERS_Update
		/// </summary>
		public static void spACL_ROLES_USERS_Update(Guid gROLE_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACL_ROLES_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACL_ROLES_USERS_Update
		/// <summary>
		/// spACL_ROLES_USERS_Update
		/// </summary>
		public static void spACL_ROLES_USERS_Update(Guid gROLE_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACL_ROLES_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACL_ROLES_USERS_Update
		/// <summary>
		/// spACL_ROLES_USERS_Update
		/// </summary>
		public static IDbCommand cmdACL_ROLES_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACL_ROLES_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACTIVITIES_Delete
		/// <summary>
		/// spACTIVITIES_Delete
		/// </summary>
		public static void spACTIVITIES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACTIVITIES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACTIVITIES_Delete
		/// <summary>
		/// spACTIVITIES_Delete
		/// </summary>
		public static void spACTIVITIES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACTIVITIES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACTIVITIES_Delete
		/// <summary>
		/// spACTIVITIES_Delete
		/// </summary>
		public static IDbCommand cmdACTIVITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACTIVITIES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spACTIVITIES_UpdateStatus
		/// <summary>
		/// spACTIVITIES_UpdateStatus
		/// </summary>
		public static void spACTIVITIES_UpdateStatus(Guid gID, Guid gUSER_ID, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spACTIVITIES_UpdateStatus";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spACTIVITIES_UpdateStatus
		/// <summary>
		/// spACTIVITIES_UpdateStatus
		/// </summary>
		public static void spACTIVITIES_UpdateStatus(Guid gID, Guid gUSER_ID, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spACTIVITIES_UpdateStatus";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdACTIVITIES_UpdateStatus
		/// <summary>
		/// spACTIVITIES_UpdateStatus
		/// </summary>
		public static IDbCommand cmdACTIVITIES_UpdateStatus(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spACTIVITIES_UpdateStatus";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			return cmd;
		}
		#endregion

		#region spAuditing_Disable
		/// <summary>
		/// spAuditing_Disable
		/// </summary>
		public static void spAuditing_Disable()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spAuditing_Disable";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spAuditing_Disable
		/// <summary>
		/// spAuditing_Disable
		/// </summary>
		public static void spAuditing_Disable(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spAuditing_Disable";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdAuditing_Disable
		/// <summary>
		/// spAuditing_Disable
		/// </summary>
		public static IDbCommand cmdAuditing_Disable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spAuditing_Disable";
			return cmd;
		}
		#endregion

		#region spAuditing_Enable
		/// <summary>
		/// spAuditing_Enable
		/// </summary>
		public static void spAuditing_Enable()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spAuditing_Enable";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spAuditing_Enable
		/// <summary>
		/// spAuditing_Enable
		/// </summary>
		public static void spAuditing_Enable(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spAuditing_Enable";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdAuditing_Enable
		/// <summary>
		/// spAuditing_Enable
		/// </summary>
		public static IDbCommand cmdAuditing_Enable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spAuditing_Enable";
			return cmd;
		}
		#endregion

		#region spBUG_ATTACHMENTS_Delete
		/// <summary>
		/// spBUG_ATTACHMENTS_Delete
		/// </summary>
		public static void spBUG_ATTACHMENTS_Delete(Guid gBUG_ID, Guid gATTACHMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUG_ATTACHMENTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							IDbDataParameter parATTACHMENT_ID    = Sql.AddParameter(cmd, "@ATTACHMENT_ID"   , gATTACHMENT_ID     );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUG_ATTACHMENTS_Delete
		/// <summary>
		/// spBUG_ATTACHMENTS_Delete
		/// </summary>
		public static void spBUG_ATTACHMENTS_Delete(Guid gBUG_ID, Guid gATTACHMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUG_ATTACHMENTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				IDbDataParameter parATTACHMENT_ID    = Sql.AddParameter(cmd, "@ATTACHMENT_ID"   , gATTACHMENT_ID     );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUG_ATTACHMENTS_Delete
		/// <summary>
		/// spBUG_ATTACHMENTS_Delete
		/// </summary>
		public static IDbCommand cmdBUG_ATTACHMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUG_ATTACHMENTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			IDbDataParameter parATTACHMENT_ID    = Sql.CreateParameter(cmd, "@ATTACHMENT_ID"   , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUG_ATTACHMENTS_Insert
		/// <summary>
		/// spBUG_ATTACHMENTS_Insert
		/// </summary>
		public static void spBUG_ATTACHMENTS_Insert(ref Guid gID, Guid gBUG_ID, string sDESCRIPTION, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUG_ATTACHMENTS_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       , 255);
							IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
							IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
							IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUG_ATTACHMENTS_Insert
		/// <summary>
		/// spBUG_ATTACHMENTS_Insert
		/// </summary>
		public static void spBUG_ATTACHMENTS_Insert(ref Guid gID, Guid gBUG_ID, string sDESCRIPTION, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUG_ATTACHMENTS_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       , 255);
				IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
				IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
				IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdBUG_ATTACHMENTS_Insert
		/// <summary>
		/// spBUG_ATTACHMENTS_Insert
		/// </summary>
		public static IDbCommand cmdBUG_ATTACHMENTS_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUG_ATTACHMENTS_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 255);
			IDbDataParameter parFILENAME         = Sql.CreateParameter(cmd, "@FILENAME"        , "string", 255);
			IDbDataParameter parFILE_EXT         = Sql.CreateParameter(cmd, "@FILE_EXT"        , "string",  25);
			IDbDataParameter parFILE_MIME_TYPE   = Sql.CreateParameter(cmd, "@FILE_MIME_TYPE"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spBUGS_ATTACHMENT_InitPointer
		/// <summary>
		/// spBUGS_ATTACHMENT_InitPointer
		/// </summary>
		public static void spBUGS_ATTACHMENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_ATTACHMENT_InitPointer";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							parFILE_POINTER.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_ATTACHMENT_InitPointer
		/// <summary>
		/// spBUGS_ATTACHMENT_InitPointer
		/// </summary>
		public static void spBUGS_ATTACHMENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_ATTACHMENT_InitPointer";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				parFILE_POINTER.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
			}
		}
		#endregion

		#region cmdBUGS_ATTACHMENT_InitPointer
		/// <summary>
		/// spBUGS_ATTACHMENT_InitPointer
		/// </summary>
		public static IDbCommand cmdBUGS_ATTACHMENT_InitPointer(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_ATTACHMENT_InitPointer";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			parFILE_POINTER.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spBUGS_ATTACHMENT_ReadOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_ReadOffset
		/// </summary>
		public static void spBUGS_ATTACHMENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_ATTACHMENT_ReadOffset";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
							IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
							IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
							parBYTES.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							byBYTES = Sql.ToBinary(parBYTES.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_ATTACHMENT_ReadOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_ReadOffset
		/// </summary>
		public static void spBUGS_ATTACHMENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_ATTACHMENT_ReadOffset";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
				IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
				IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
				parBYTES.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				byBYTES = Sql.ToBinary(parBYTES.Value);
			}
		}
		#endregion

		#region cmdBUGS_ATTACHMENT_ReadOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_ReadOffset
		/// </summary>
		public static IDbCommand cmdBUGS_ATTACHMENT_ReadOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_ATTACHMENT_ReadOffset";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parFILE_OFFSET = Sql.CreateParameter(cmd, "@FILE_OFFSET", "Int32",   4);
			IDbDataParameter parREAD_SIZE   = Sql.CreateParameter(cmd, "@READ_SIZE"  , "Int32",   4);
			IDbDataParameter parBYTES       = Sql.CreateParameter(cmd, "@BYTES"      , "byte[]",  16);
			parBYTES.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spBUGS_ATTACHMENT_WriteOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_WriteOffset
		/// </summary>
		public static void spBUGS_ATTACHMENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_ATTACHMENT_WriteOffset";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
							IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_ATTACHMENT_WriteOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_WriteOffset
		/// </summary>
		public static void spBUGS_ATTACHMENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_ATTACHMENT_WriteOffset";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
				IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_ATTACHMENT_WriteOffset
		/// <summary>
		/// spBUGS_ATTACHMENT_WriteOffset
		/// </summary>
		public static IDbCommand cmdBUGS_ATTACHMENT_WriteOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_ATTACHMENT_WriteOffset";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_OFFSET      = Sql.CreateParameter(cmd, "@FILE_OFFSET"     , "Int32",   4);
			IDbDataParameter parBYTES            = Sql.CreateParameter(cmd, "@BYTES"           , "byte[]",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_Delete
		/// <summary>
		/// spBUGS_Delete
		/// </summary>
		public static void spBUGS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_Delete
		/// <summary>
		/// spBUGS_Delete
		/// </summary>
		public static void spBUGS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_Delete
		/// <summary>
		/// spBUGS_Delete
		/// </summary>
		public static IDbCommand cmdBUGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_MassDelete
		/// <summary>
		/// spBUGS_MassDelete
		/// </summary>
		public static void spBUGS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_MassDelete
		/// <summary>
		/// spBUGS_MassDelete
		/// </summary>
		public static void spBUGS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_MassDelete
		/// <summary>
		/// spBUGS_MassDelete
		/// </summary>
		public static IDbCommand cmdBUGS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_MassUpdate
		/// <summary>
		/// spBUGS_MassUpdate
		/// </summary>
		public static void spBUGS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, string sPRIORITY, string sRESOLUTION, string sTYPE, string sSOURCE, string sPRODUCT_CATEGORY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        , 255);
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
							IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            , 255);
							IDbDataParameter parPRODUCT_CATEGORY = Sql.AddParameter(cmd, "@PRODUCT_CATEGORY", sPRODUCT_CATEGORY  , 255);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_MassUpdate
		/// <summary>
		/// spBUGS_MassUpdate
		/// </summary>
		public static void spBUGS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, string sPRIORITY, string sRESOLUTION, string sTYPE, string sSOURCE, string sPRODUCT_CATEGORY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        , 255);
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
				IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            , 255);
				IDbDataParameter parPRODUCT_CATEGORY = Sql.AddParameter(cmd, "@PRODUCT_CATEGORY", sPRODUCT_CATEGORY  , 255);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_MassUpdate
		/// <summary>
		/// spBUGS_MassUpdate
		/// </summary>
		public static IDbCommand cmdBUGS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parRESOLUTION       = Sql.CreateParameter(cmd, "@RESOLUTION"      , "string", 255);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string", 255);
			IDbDataParameter parSOURCE           = Sql.CreateParameter(cmd, "@SOURCE"          , "string", 255);
			IDbDataParameter parPRODUCT_CATEGORY = Sql.CreateParameter(cmd, "@PRODUCT_CATEGORY", "string", 255);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_New
		/// <summary>
		/// spBUGS_New
		/// </summary>
		public static void spBUGS_New(ref Guid gID, string sNAME, string sPRIORITY, string sFOUND_IN_RELEASE, string sTYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parFOUND_IN_RELEASE = Sql.AddParameter(cmd, "@FOUND_IN_RELEASE", sFOUND_IN_RELEASE  , 255);
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_New
		/// <summary>
		/// spBUGS_New
		/// </summary>
		public static void spBUGS_New(ref Guid gID, string sNAME, string sPRIORITY, string sFOUND_IN_RELEASE, string sTYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parFOUND_IN_RELEASE = Sql.AddParameter(cmd, "@FOUND_IN_RELEASE", sFOUND_IN_RELEASE  , 255);
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdBUGS_New
		/// <summary>
		/// spBUGS_New
		/// </summary>
		public static IDbCommand cmdBUGS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parFOUND_IN_RELEASE = Sql.CreateParameter(cmd, "@FOUND_IN_RELEASE", "string", 255);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spBUGS_THREADS_Delete
		/// <summary>
		/// spBUGS_THREADS_Delete
		/// </summary>
		public static void spBUGS_THREADS_Delete(Guid gBUG_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_THREADS_Delete
		/// <summary>
		/// spBUGS_THREADS_Delete
		/// </summary>
		public static void spBUGS_THREADS_Delete(Guid gBUG_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_THREADS_Delete
		/// <summary>
		/// spBUGS_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdBUGS_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_THREADS_Update
		/// <summary>
		/// spBUGS_THREADS_Update
		/// </summary>
		public static void spBUGS_THREADS_Update(Guid gBUG_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_THREADS_Update
		/// <summary>
		/// spBUGS_THREADS_Update
		/// </summary>
		public static void spBUGS_THREADS_Update(Guid gBUG_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdBUGS_THREADS_Update
		/// <summary>
		/// spBUGS_THREADS_Update
		/// </summary>
		public static IDbCommand cmdBUGS_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spBUGS_Update
		/// <summary>
		/// spBUGS_Update
		/// </summary>
		public static void spBUGS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, string sPRIORITY, string sDESCRIPTION, string sRESOLUTION, string sFOUND_IN_RELEASE, string sTYPE, string sFIXED_IN_RELEASE, string sWORK_LOG, string sSOURCE, string sPRODUCT_CATEGORY, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spBUGS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        , 255);
							IDbDataParameter parFOUND_IN_RELEASE = Sql.AddParameter(cmd, "@FOUND_IN_RELEASE", sFOUND_IN_RELEASE  , 255);
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
							IDbDataParameter parFIXED_IN_RELEASE = Sql.AddParameter(cmd, "@FIXED_IN_RELEASE", sFIXED_IN_RELEASE  , 255);
							IDbDataParameter parWORK_LOG         = Sql.AddParameter(cmd, "@WORK_LOG"        , sWORK_LOG          );
							IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            , 255);
							IDbDataParameter parPRODUCT_CATEGORY = Sql.AddParameter(cmd, "@PRODUCT_CATEGORY", sPRODUCT_CATEGORY  , 255);
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spBUGS_Update
		/// <summary>
		/// spBUGS_Update
		/// </summary>
		public static void spBUGS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, string sPRIORITY, string sDESCRIPTION, string sRESOLUTION, string sFOUND_IN_RELEASE, string sTYPE, string sFIXED_IN_RELEASE, string sWORK_LOG, string sSOURCE, string sPRODUCT_CATEGORY, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spBUGS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        , 255);
				IDbDataParameter parFOUND_IN_RELEASE = Sql.AddParameter(cmd, "@FOUND_IN_RELEASE", sFOUND_IN_RELEASE  , 255);
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
				IDbDataParameter parFIXED_IN_RELEASE = Sql.AddParameter(cmd, "@FIXED_IN_RELEASE", sFIXED_IN_RELEASE  , 255);
				IDbDataParameter parWORK_LOG         = Sql.AddParameter(cmd, "@WORK_LOG"        , sWORK_LOG          );
				IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            , 255);
				IDbDataParameter parPRODUCT_CATEGORY = Sql.AddParameter(cmd, "@PRODUCT_CATEGORY", sPRODUCT_CATEGORY  , 255);
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdBUGS_Update
		/// <summary>
		/// spBUGS_Update
		/// </summary>
		public static IDbCommand cmdBUGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spBUGS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parRESOLUTION       = Sql.CreateParameter(cmd, "@RESOLUTION"      , "string", 255);
			IDbDataParameter parFOUND_IN_RELEASE = Sql.CreateParameter(cmd, "@FOUND_IN_RELEASE", "string", 255);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string", 255);
			IDbDataParameter parFIXED_IN_RELEASE = Sql.CreateParameter(cmd, "@FIXED_IN_RELEASE", "string", 255);
			IDbDataParameter parWORK_LOG         = Sql.CreateParameter(cmd, "@WORK_LOG"        , "string", 104857600);
			IDbDataParameter parSOURCE           = Sql.CreateParameter(cmd, "@SOURCE"          , "string", 255);
			IDbDataParameter parPRODUCT_CATEGORY = Sql.CreateParameter(cmd, "@PRODUCT_CATEGORY", "string", 255);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCALLS_CONTACTS_Delete
		/// <summary>
		/// spCALLS_CONTACTS_Delete
		/// </summary>
		public static void spCALLS_CONTACTS_Delete(Guid gCALL_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_CONTACTS_Delete
		/// <summary>
		/// spCALLS_CONTACTS_Delete
		/// </summary>
		public static void spCALLS_CONTACTS_Delete(Guid gCALL_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_CONTACTS_Delete
		/// <summary>
		/// spCALLS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdCALLS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCALL_ID          = Sql.CreateParameter(cmd, "@CALL_ID"         , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCALLS_CONTACTS_Update
		/// <summary>
		/// spCALLS_CONTACTS_Update
		/// </summary>
		public static void spCALLS_CONTACTS_Update(Guid gCALL_ID, Guid gCONTACT_ID, bool bREQUIRED, string sACCEPT_STATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_CONTACTS_Update
		/// <summary>
		/// spCALLS_CONTACTS_Update
		/// </summary>
		public static void spCALLS_CONTACTS_Update(Guid gCALL_ID, Guid gCONTACT_ID, bool bREQUIRED, string sACCEPT_STATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_CONTACTS_Update
		/// <summary>
		/// spCALLS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdCALLS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCALL_ID          = Sql.CreateParameter(cmd, "@CALL_ID"         , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parACCEPT_STATUS    = Sql.CreateParameter(cmd, "@ACCEPT_STATUS"   , "string",  25);
			return cmd;
		}
		#endregion

		#region spCALLS_Delete
		/// <summary>
		/// spCALLS_Delete
		/// </summary>
		public static void spCALLS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_Delete
		/// <summary>
		/// spCALLS_Delete
		/// </summary>
		public static void spCALLS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_Delete
		/// <summary>
		/// spCALLS_Delete
		/// </summary>
		public static IDbCommand cmdCALLS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCALLS_InviteeMassUpdate
		/// <summary>
		/// spCALLS_InviteeMassUpdate
		/// </summary>
		public static void spCALLS_InviteeMassUpdate(Guid gCALL_ID, string sID_LIST, bool bREQUIRED)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_InviteeMassUpdate";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_InviteeMassUpdate
		/// <summary>
		/// spCALLS_InviteeMassUpdate
		/// </summary>
		public static void spCALLS_InviteeMassUpdate(Guid gCALL_ID, string sID_LIST, bool bREQUIRED, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_InviteeMassUpdate";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_InviteeMassUpdate
		/// <summary>
		/// spCALLS_InviteeMassUpdate
		/// </summary>
		public static IDbCommand cmdCALLS_InviteeMassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_InviteeMassUpdate";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCALL_ID          = Sql.CreateParameter(cmd, "@CALL_ID"         , "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			return cmd;
		}
		#endregion

		#region spCALLS_MassDelete
		/// <summary>
		/// spCALLS_MassDelete
		/// </summary>
		public static void spCALLS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_MassDelete
		/// <summary>
		/// spCALLS_MassDelete
		/// </summary>
		public static void spCALLS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_MassDelete
		/// <summary>
		/// spCALLS_MassDelete
		/// </summary>
		public static IDbCommand cmdCALLS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCALLS_MassUpdate
		/// <summary>
		/// spCALLS_MassUpdate
		/// </summary>
		public static void spCALLS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtDATE_TIME, string sSTATUS, string sDIRECTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDIRECTION        = Sql.AddParameter(cmd, "@DIRECTION"       , sDIRECTION         ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_MassUpdate
		/// <summary>
		/// spCALLS_MassUpdate
		/// </summary>
		public static void spCALLS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtDATE_TIME, string sSTATUS, string sDIRECTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDIRECTION        = Sql.AddParameter(cmd, "@DIRECTION"       , sDIRECTION         ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_MassUpdate
		/// <summary>
		/// spCALLS_MassUpdate
		/// </summary>
		public static IDbCommand cmdCALLS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDIRECTION        = Sql.CreateParameter(cmd, "@DIRECTION"       , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCALLS_New
		/// <summary>
		/// spCALLS_New
		/// </summary>
		public static void spCALLS_New(ref Guid gID, string sNAME, DateTime dtDATE_TIME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_New
		/// <summary>
		/// spCALLS_New
		/// </summary>
		public static void spCALLS_New(ref Guid gID, string sNAME, DateTime dtDATE_TIME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCALLS_New
		/// <summary>
		/// spCALLS_New
		/// </summary>
		public static IDbCommand cmdCALLS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCALLS_Update
		/// <summary>
		/// spCALLS_Update
		/// </summary>
		public static void spCALLS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Int32 nDURATION_HOURS, Int32 nDURATION_MINUTES, DateTime dtDATE_TIME, string sPARENT_TYPE, Guid gPARENT_ID, string sSTATUS, string sDIRECTION, Int32 nREMINDER_TIME, string sDESCRIPTION, string sINVITEE_LIST, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDURATION_HOURS   = Sql.AddParameter(cmd, "@DURATION_HOURS"  , nDURATION_HOURS    );
							IDbDataParameter parDURATION_MINUTES = Sql.AddParameter(cmd, "@DURATION_MINUTES", nDURATION_MINUTES  );
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDIRECTION        = Sql.AddParameter(cmd, "@DIRECTION"       , sDIRECTION         ,  25);
							IDbDataParameter parREMINDER_TIME    = Sql.AddParameter(cmd, "@REMINDER_TIME"   , nREMINDER_TIME     );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parINVITEE_LIST     = Sql.AddAnsiParam(cmd, "@INVITEE_LIST"    , sINVITEE_LIST      , 8000);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_Update
		/// <summary>
		/// spCALLS_Update
		/// </summary>
		public static void spCALLS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Int32 nDURATION_HOURS, Int32 nDURATION_MINUTES, DateTime dtDATE_TIME, string sPARENT_TYPE, Guid gPARENT_ID, string sSTATUS, string sDIRECTION, Int32 nREMINDER_TIME, string sDESCRIPTION, string sINVITEE_LIST, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDURATION_HOURS   = Sql.AddParameter(cmd, "@DURATION_HOURS"  , nDURATION_HOURS    );
				IDbDataParameter parDURATION_MINUTES = Sql.AddParameter(cmd, "@DURATION_MINUTES", nDURATION_MINUTES  );
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDIRECTION        = Sql.AddParameter(cmd, "@DIRECTION"       , sDIRECTION         ,  25);
				IDbDataParameter parREMINDER_TIME    = Sql.AddParameter(cmd, "@REMINDER_TIME"   , nREMINDER_TIME     );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parINVITEE_LIST     = Sql.AddAnsiParam(cmd, "@INVITEE_LIST"    , sINVITEE_LIST      , 8000);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCALLS_Update
		/// <summary>
		/// spCALLS_Update
		/// </summary>
		public static IDbCommand cmdCALLS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDURATION_HOURS   = Sql.CreateParameter(cmd, "@DURATION_HOURS"  , "Int32",   4);
			IDbDataParameter parDURATION_MINUTES = Sql.CreateParameter(cmd, "@DURATION_MINUTES", "Int32",   4);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDIRECTION        = Sql.CreateParameter(cmd, "@DIRECTION"       , "string",  25);
			IDbDataParameter parREMINDER_TIME    = Sql.CreateParameter(cmd, "@REMINDER_TIME"   , "Int32",   4);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parINVITEE_LIST     = Sql.CreateParameter(cmd, "@INVITEE_LIST"    , "ansistring", 8000);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCALLS_USERS_Delete
		/// <summary>
		/// spCALLS_USERS_Delete
		/// </summary>
		public static void spCALLS_USERS_Delete(Guid gCALL_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_USERS_Delete
		/// <summary>
		/// spCALLS_USERS_Delete
		/// </summary>
		public static void spCALLS_USERS_Delete(Guid gCALL_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_USERS_Delete
		/// <summary>
		/// spCALLS_USERS_Delete
		/// </summary>
		public static IDbCommand cmdCALLS_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCALL_ID          = Sql.CreateParameter(cmd, "@CALL_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCALLS_USERS_Update
		/// <summary>
		/// spCALLS_USERS_Update
		/// </summary>
		public static void spCALLS_USERS_Update(Guid gCALL_ID, Guid gUSER_ID, bool bREQUIRED, string sACCEPT_STATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCALLS_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCALLS_USERS_Update
		/// <summary>
		/// spCALLS_USERS_Update
		/// </summary>
		public static void spCALLS_USERS_Update(Guid gCALL_ID, Guid gUSER_ID, bool bREQUIRED, string sACCEPT_STATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCALLS_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCALL_ID          = Sql.AddParameter(cmd, "@CALL_ID"         , gCALL_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCALLS_USERS_Update
		/// <summary>
		/// spCALLS_USERS_Update
		/// </summary>
		public static IDbCommand cmdCALLS_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCALLS_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCALL_ID          = Sql.CreateParameter(cmd, "@CALL_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parACCEPT_STATUS    = Sql.CreateParameter(cmd, "@ACCEPT_STATUS"   , "string",  25);
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_LOG_BannerTracker
		/// <summary>
		/// spCAMPAIGN_LOG_BannerTracker
		/// </summary>
		public static void spCAMPAIGN_LOG_BannerTracker(string sACTIVITY_TYPE, Guid gCAMPAIGN_TRKRS_ID, string sMORE_INFORMATION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_LOG_BannerTracker";
							IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
							IDbDataParameter parACTIVITY_TYPE     = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"    , sACTIVITY_TYPE      ,  25);
							IDbDataParameter parCAMPAIGN_TRKRS_ID = Sql.AddParameter(cmd, "@CAMPAIGN_TRKRS_ID", gCAMPAIGN_TRKRS_ID  );
							IDbDataParameter parMORE_INFORMATION  = Sql.AddParameter(cmd, "@MORE_INFORMATION" , sMORE_INFORMATION   , 100);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_LOG_BannerTracker
		/// <summary>
		/// spCAMPAIGN_LOG_BannerTracker
		/// </summary>
		public static void spCAMPAIGN_LOG_BannerTracker(string sACTIVITY_TYPE, Guid gCAMPAIGN_TRKRS_ID, string sMORE_INFORMATION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_LOG_BannerTracker";
				IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
				IDbDataParameter parACTIVITY_TYPE     = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"    , sACTIVITY_TYPE      ,  25);
				IDbDataParameter parCAMPAIGN_TRKRS_ID = Sql.AddParameter(cmd, "@CAMPAIGN_TRKRS_ID", gCAMPAIGN_TRKRS_ID  );
				IDbDataParameter parMORE_INFORMATION  = Sql.AddParameter(cmd, "@MORE_INFORMATION" , sMORE_INFORMATION   , 100);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGN_LOG_BannerTracker
		/// <summary>
		/// spCAMPAIGN_LOG_BannerTracker
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_LOG_BannerTracker(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_LOG_BannerTracker";
			IDbDataParameter parMODIFIED_USER_ID  = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID" , "Guid",  16);
			IDbDataParameter parACTIVITY_TYPE     = Sql.CreateParameter(cmd, "@ACTIVITY_TYPE"    , "string",  25);
			IDbDataParameter parCAMPAIGN_TRKRS_ID = Sql.CreateParameter(cmd, "@CAMPAIGN_TRKRS_ID", "Guid",  16);
			IDbDataParameter parMORE_INFORMATION  = Sql.CreateParameter(cmd, "@MORE_INFORMATION" , "string", 100);
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_LOG_Delete
		/// <summary>
		/// spCAMPAIGN_LOG_Delete
		/// </summary>
		public static void spCAMPAIGN_LOG_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_LOG_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_LOG_Delete
		/// <summary>
		/// spCAMPAIGN_LOG_Delete
		/// </summary>
		public static void spCAMPAIGN_LOG_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_LOG_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGN_LOG_Delete
		/// <summary>
		/// spCAMPAIGN_LOG_Delete
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_LOG_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_LOG_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_LOG_InsertOnly
		/// <summary>
		/// spCAMPAIGN_LOG_InsertOnly
		/// </summary>
		public static void spCAMPAIGN_LOG_InsertOnly(Guid gCAMPAIGN_ID, Guid gTARGET_TRACKER_KEY, Guid gTARGET_ID, string sTARGET_TYPE, string sACTIVITY_TYPE, Guid gRELATED_ID, string sRELATED_TYPE, Guid gMARKETING_ID, Guid gLIST_ID, string sMORE_INFORMATION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_LOG_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
							IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
							IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
							IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
							IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
							IDbDataParameter parRELATED_ID         = Sql.AddParameter(cmd, "@RELATED_ID"        , gRELATED_ID          );
							IDbDataParameter parRELATED_TYPE       = Sql.AddParameter(cmd, "@RELATED_TYPE"      , sRELATED_TYPE        ,  25);
							IDbDataParameter parMARKETING_ID       = Sql.AddParameter(cmd, "@MARKETING_ID"      , gMARKETING_ID        );
							IDbDataParameter parLIST_ID            = Sql.AddParameter(cmd, "@LIST_ID"           , gLIST_ID             );
							IDbDataParameter parMORE_INFORMATION   = Sql.AddParameter(cmd, "@MORE_INFORMATION"  , sMORE_INFORMATION    , 100);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_LOG_InsertOnly
		/// <summary>
		/// spCAMPAIGN_LOG_InsertOnly
		/// </summary>
		public static void spCAMPAIGN_LOG_InsertOnly(Guid gCAMPAIGN_ID, Guid gTARGET_TRACKER_KEY, Guid gTARGET_ID, string sTARGET_TYPE, string sACTIVITY_TYPE, Guid gRELATED_ID, string sRELATED_TYPE, Guid gMARKETING_ID, Guid gLIST_ID, string sMORE_INFORMATION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_LOG_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
				IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
				IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
				IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
				IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
				IDbDataParameter parRELATED_ID         = Sql.AddParameter(cmd, "@RELATED_ID"        , gRELATED_ID          );
				IDbDataParameter parRELATED_TYPE       = Sql.AddParameter(cmd, "@RELATED_TYPE"      , sRELATED_TYPE        ,  25);
				IDbDataParameter parMARKETING_ID       = Sql.AddParameter(cmd, "@MARKETING_ID"      , gMARKETING_ID        );
				IDbDataParameter parLIST_ID            = Sql.AddParameter(cmd, "@LIST_ID"           , gLIST_ID             );
				IDbDataParameter parMORE_INFORMATION   = Sql.AddParameter(cmd, "@MORE_INFORMATION"  , sMORE_INFORMATION    , 100);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGN_LOG_InsertOnly
		/// <summary>
		/// spCAMPAIGN_LOG_InsertOnly
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_LOG_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_LOG_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID        = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"       , "Guid",  16);
			IDbDataParameter parTARGET_TRACKER_KEY = Sql.CreateParameter(cmd, "@TARGET_TRACKER_KEY", "Guid",  16);
			IDbDataParameter parTARGET_ID          = Sql.CreateParameter(cmd, "@TARGET_ID"         , "Guid",  16);
			IDbDataParameter parTARGET_TYPE        = Sql.CreateParameter(cmd, "@TARGET_TYPE"       , "string",  25);
			IDbDataParameter parACTIVITY_TYPE      = Sql.CreateParameter(cmd, "@ACTIVITY_TYPE"     , "string",  25);
			IDbDataParameter parRELATED_ID         = Sql.CreateParameter(cmd, "@RELATED_ID"        , "Guid",  16);
			IDbDataParameter parRELATED_TYPE       = Sql.CreateParameter(cmd, "@RELATED_TYPE"      , "string",  25);
			IDbDataParameter parMARKETING_ID       = Sql.CreateParameter(cmd, "@MARKETING_ID"      , "Guid",  16);
			IDbDataParameter parLIST_ID            = Sql.CreateParameter(cmd, "@LIST_ID"           , "Guid",  16);
			IDbDataParameter parMORE_INFORMATION   = Sql.CreateParameter(cmd, "@MORE_INFORMATION"  , "string", 100);
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_LOG_Update
		/// <summary>
		/// spCAMPAIGN_LOG_Update
		/// </summary>
		public static void spCAMPAIGN_LOG_Update(ref Guid gID, Guid gCAMPAIGN_ID, Guid gTARGET_TRACKER_KEY, Guid gTARGET_ID, string sTARGET_TYPE, string sACTIVITY_TYPE, DateTime dtACTIVITY_DATE, Guid gRELATED_ID, string sRELATED_TYPE, bool bARCHIVED, Int32 nHITS, Guid gLIST_ID, string sMORE_INFORMATION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_LOG_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
							IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
							IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
							IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
							IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
							IDbDataParameter parACTIVITY_DATE      = Sql.AddParameter(cmd, "@ACTIVITY_DATE"     , dtACTIVITY_DATE      );
							IDbDataParameter parRELATED_ID         = Sql.AddParameter(cmd, "@RELATED_ID"        , gRELATED_ID          );
							IDbDataParameter parRELATED_TYPE       = Sql.AddParameter(cmd, "@RELATED_TYPE"      , sRELATED_TYPE        ,  25);
							IDbDataParameter parARCHIVED           = Sql.AddParameter(cmd, "@ARCHIVED"          , bARCHIVED            );
							IDbDataParameter parHITS               = Sql.AddParameter(cmd, "@HITS"              , nHITS                );
							IDbDataParameter parLIST_ID            = Sql.AddParameter(cmd, "@LIST_ID"           , gLIST_ID             );
							IDbDataParameter parMORE_INFORMATION   = Sql.AddParameter(cmd, "@MORE_INFORMATION"  , sMORE_INFORMATION    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_LOG_Update
		/// <summary>
		/// spCAMPAIGN_LOG_Update
		/// </summary>
		public static void spCAMPAIGN_LOG_Update(ref Guid gID, Guid gCAMPAIGN_ID, Guid gTARGET_TRACKER_KEY, Guid gTARGET_ID, string sTARGET_TYPE, string sACTIVITY_TYPE, DateTime dtACTIVITY_DATE, Guid gRELATED_ID, string sRELATED_TYPE, bool bARCHIVED, Int32 nHITS, Guid gLIST_ID, string sMORE_INFORMATION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_LOG_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
				IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
				IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
				IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
				IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
				IDbDataParameter parACTIVITY_DATE      = Sql.AddParameter(cmd, "@ACTIVITY_DATE"     , dtACTIVITY_DATE      );
				IDbDataParameter parRELATED_ID         = Sql.AddParameter(cmd, "@RELATED_ID"        , gRELATED_ID          );
				IDbDataParameter parRELATED_TYPE       = Sql.AddParameter(cmd, "@RELATED_TYPE"      , sRELATED_TYPE        ,  25);
				IDbDataParameter parARCHIVED           = Sql.AddParameter(cmd, "@ARCHIVED"          , bARCHIVED            );
				IDbDataParameter parHITS               = Sql.AddParameter(cmd, "@HITS"              , nHITS                );
				IDbDataParameter parLIST_ID            = Sql.AddParameter(cmd, "@LIST_ID"           , gLIST_ID             );
				IDbDataParameter parMORE_INFORMATION   = Sql.AddParameter(cmd, "@MORE_INFORMATION"  , sMORE_INFORMATION    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCAMPAIGN_LOG_Update
		/// <summary>
		/// spCAMPAIGN_LOG_Update
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_LOG_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_LOG_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID        = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"       , "Guid",  16);
			IDbDataParameter parTARGET_TRACKER_KEY = Sql.CreateParameter(cmd, "@TARGET_TRACKER_KEY", "Guid",  16);
			IDbDataParameter parTARGET_ID          = Sql.CreateParameter(cmd, "@TARGET_ID"         , "Guid",  16);
			IDbDataParameter parTARGET_TYPE        = Sql.CreateParameter(cmd, "@TARGET_TYPE"       , "string",  25);
			IDbDataParameter parACTIVITY_TYPE      = Sql.CreateParameter(cmd, "@ACTIVITY_TYPE"     , "string",  25);
			IDbDataParameter parACTIVITY_DATE      = Sql.CreateParameter(cmd, "@ACTIVITY_DATE"     , "DateTime",   8);
			IDbDataParameter parRELATED_ID         = Sql.CreateParameter(cmd, "@RELATED_ID"        , "Guid",  16);
			IDbDataParameter parRELATED_TYPE       = Sql.CreateParameter(cmd, "@RELATED_TYPE"      , "string",  25);
			IDbDataParameter parARCHIVED           = Sql.CreateParameter(cmd, "@ARCHIVED"          , "bool",   1);
			IDbDataParameter parHITS               = Sql.CreateParameter(cmd, "@HITS"              , "Int32",   4);
			IDbDataParameter parLIST_ID            = Sql.CreateParameter(cmd, "@LIST_ID"           , "Guid",  16);
			IDbDataParameter parMORE_INFORMATION   = Sql.CreateParameter(cmd, "@MORE_INFORMATION"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_LOG_UpdateTracker
		/// <summary>
		/// spCAMPAIGN_LOG_UpdateTracker
		/// </summary>
		public static void spCAMPAIGN_LOG_UpdateTracker(Guid gTARGET_TRACKER_KEY, string sACTIVITY_TYPE, Guid gCAMPAIGN_TRKRS_ID, ref Guid gTARGET_ID, ref string sTARGET_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_LOG_UpdateTracker";
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
							IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
							IDbDataParameter parCAMPAIGN_TRKRS_ID  = Sql.AddParameter(cmd, "@CAMPAIGN_TRKRS_ID" , gCAMPAIGN_TRKRS_ID   );
							IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
							IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
							parTARGET_ID.Direction = ParameterDirection.InputOutput;
							parTARGET_TYPE.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gTARGET_ID = Sql.ToGuid(parTARGET_ID.Value);
							sTARGET_TYPE = Sql.ToString(parTARGET_TYPE.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_LOG_UpdateTracker
		/// <summary>
		/// spCAMPAIGN_LOG_UpdateTracker
		/// </summary>
		public static void spCAMPAIGN_LOG_UpdateTracker(Guid gTARGET_TRACKER_KEY, string sACTIVITY_TYPE, Guid gCAMPAIGN_TRKRS_ID, ref Guid gTARGET_ID, ref string sTARGET_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_LOG_UpdateTracker";
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
				IDbDataParameter parACTIVITY_TYPE      = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"     , sACTIVITY_TYPE       ,  25);
				IDbDataParameter parCAMPAIGN_TRKRS_ID  = Sql.AddParameter(cmd, "@CAMPAIGN_TRKRS_ID" , gCAMPAIGN_TRKRS_ID   );
				IDbDataParameter parTARGET_ID          = Sql.AddParameter(cmd, "@TARGET_ID"         , gTARGET_ID           );
				IDbDataParameter parTARGET_TYPE        = Sql.AddParameter(cmd, "@TARGET_TYPE"       , sTARGET_TYPE         ,  25);
				parTARGET_ID.Direction = ParameterDirection.InputOutput;
				parTARGET_TYPE.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gTARGET_ID = Sql.ToGuid(parTARGET_ID.Value);
				sTARGET_TYPE = Sql.ToString(parTARGET_TYPE.Value);
			}
		}
		#endregion

		#region cmdCAMPAIGN_LOG_UpdateTracker
		/// <summary>
		/// spCAMPAIGN_LOG_UpdateTracker
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_LOG_UpdateTracker(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_LOG_UpdateTracker";
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parTARGET_TRACKER_KEY = Sql.CreateParameter(cmd, "@TARGET_TRACKER_KEY", "Guid",  16);
			IDbDataParameter parACTIVITY_TYPE      = Sql.CreateParameter(cmd, "@ACTIVITY_TYPE"     , "string",  25);
			IDbDataParameter parCAMPAIGN_TRKRS_ID  = Sql.CreateParameter(cmd, "@CAMPAIGN_TRKRS_ID" , "Guid",  16);
			IDbDataParameter parTARGET_ID          = Sql.CreateParameter(cmd, "@TARGET_ID"         , "Guid",  16);
			IDbDataParameter parTARGET_TYPE        = Sql.CreateParameter(cmd, "@TARGET_TYPE"       , "string",  25);
			parTARGET_ID.Direction = ParameterDirection.InputOutput;
			parTARGET_TYPE.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_TRKRS_Delete
		/// <summary>
		/// spCAMPAIGN_TRKRS_Delete
		/// </summary>
		public static void spCAMPAIGN_TRKRS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_TRKRS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_TRKRS_Delete
		/// <summary>
		/// spCAMPAIGN_TRKRS_Delete
		/// </summary>
		public static void spCAMPAIGN_TRKRS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_TRKRS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGN_TRKRS_Delete
		/// <summary>
		/// spCAMPAIGN_TRKRS_Delete
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_TRKRS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_TRKRS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGN_TRKRS_Update
		/// <summary>
		/// spCAMPAIGN_TRKRS_Update
		/// </summary>
		public static void spCAMPAIGN_TRKRS_Update(ref Guid gID, string sTRACKER_NAME, string sTRACKER_URL, Guid gCAMPAIGN_ID, bool bIS_OPTOUT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGN_TRKRS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTRACKER_NAME     = Sql.AddParameter(cmd, "@TRACKER_NAME"    , sTRACKER_NAME      ,  30);
							IDbDataParameter parTRACKER_URL      = Sql.AddParameter(cmd, "@TRACKER_URL"     , sTRACKER_URL       , 255);
							IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
							IDbDataParameter parIS_OPTOUT        = Sql.AddParameter(cmd, "@IS_OPTOUT"       , bIS_OPTOUT         );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGN_TRKRS_Update
		/// <summary>
		/// spCAMPAIGN_TRKRS_Update
		/// </summary>
		public static void spCAMPAIGN_TRKRS_Update(ref Guid gID, string sTRACKER_NAME, string sTRACKER_URL, Guid gCAMPAIGN_ID, bool bIS_OPTOUT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGN_TRKRS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTRACKER_NAME     = Sql.AddParameter(cmd, "@TRACKER_NAME"    , sTRACKER_NAME      ,  30);
				IDbDataParameter parTRACKER_URL      = Sql.AddParameter(cmd, "@TRACKER_URL"     , sTRACKER_URL       , 255);
				IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
				IDbDataParameter parIS_OPTOUT        = Sql.AddParameter(cmd, "@IS_OPTOUT"       , bIS_OPTOUT         );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCAMPAIGN_TRKRS_Update
		/// <summary>
		/// spCAMPAIGN_TRKRS_Update
		/// </summary>
		public static IDbCommand cmdCAMPAIGN_TRKRS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGN_TRKRS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTRACKER_NAME     = Sql.CreateParameter(cmd, "@TRACKER_NAME"    , "string",  30);
			IDbDataParameter parTRACKER_URL      = Sql.CreateParameter(cmd, "@TRACKER_URL"     , "string", 255);
			IDbDataParameter parCAMPAIGN_ID      = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"     , "Guid",  16);
			IDbDataParameter parIS_OPTOUT        = Sql.CreateParameter(cmd, "@IS_OPTOUT"       , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_Delete
		/// <summary>
		/// spCAMPAIGNS_Delete
		/// </summary>
		public static void spCAMPAIGNS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_Delete
		/// <summary>
		/// spCAMPAIGNS_Delete
		/// </summary>
		public static void spCAMPAIGNS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_Delete
		/// <summary>
		/// spCAMPAIGNS_Delete
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_DeleteTestEntries
		/// <summary>
		/// spCAMPAIGNS_DeleteTestEntries
		/// </summary>
		public static void spCAMPAIGNS_DeleteTestEntries(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_DeleteTestEntries";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_DeleteTestEntries
		/// <summary>
		/// spCAMPAIGNS_DeleteTestEntries
		/// </summary>
		public static void spCAMPAIGNS_DeleteTestEntries(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_DeleteTestEntries";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_DeleteTestEntries
		/// <summary>
		/// spCAMPAIGNS_DeleteTestEntries
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_DeleteTestEntries(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_DeleteTestEntries";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_MassDelete
		/// <summary>
		/// spCAMPAIGNS_MassDelete
		/// </summary>
		public static void spCAMPAIGNS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_MassDelete
		/// <summary>
		/// spCAMPAIGNS_MassDelete
		/// </summary>
		public static void spCAMPAIGNS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_MassDelete
		/// <summary>
		/// spCAMPAIGNS_MassDelete
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_MassUpdate
		/// <summary>
		/// spCAMPAIGNS_MassUpdate
		/// </summary>
		public static void spCAMPAIGNS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, string sSTATUS, string sCAMPAIGN_TYPE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
							IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_MassUpdate
		/// <summary>
		/// spCAMPAIGNS_MassUpdate
		/// </summary>
		public static void spCAMPAIGNS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, string sSTATUS, string sCAMPAIGN_TYPE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
				IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_MassUpdate
		/// <summary>
		/// spCAMPAIGNS_MassUpdate
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parSTART_DATE       = Sql.CreateParameter(cmd, "@START_DATE"      , "DateTime",   8);
			IDbDataParameter parEND_DATE         = Sql.CreateParameter(cmd, "@END_DATE"        , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parCAMPAIGN_TYPE    = Sql.CreateParameter(cmd, "@CAMPAIGN_TYPE"   , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_New
		/// <summary>
		/// spCAMPAIGNS_New
		/// </summary>
		public static void spCAMPAIGNS_New(ref Guid gID, string sNAME, DateTime dtEND_DATE, string sSTATUS, string sCAMPAIGN_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_New
		/// <summary>
		/// spCAMPAIGNS_New
		/// </summary>
		public static void spCAMPAIGNS_New(ref Guid gID, string sNAME, DateTime dtEND_DATE, string sSTATUS, string sCAMPAIGN_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCAMPAIGNS_New
		/// <summary>
		/// spCAMPAIGNS_New
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parEND_DATE         = Sql.CreateParameter(cmd, "@END_DATE"        , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parCAMPAIGN_TYPE    = Sql.CreateParameter(cmd, "@CAMPAIGN_TYPE"   , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_OptOut
		/// <summary>
		/// spCAMPAIGNS_OptOut
		/// </summary>
		public static void spCAMPAIGNS_OptOut(Guid gRELATED_ID, string sRELATED_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_OptOut";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
							IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_OptOut
		/// <summary>
		/// spCAMPAIGNS_OptOut
		/// </summary>
		public static void spCAMPAIGNS_OptOut(Guid gRELATED_ID, string sRELATED_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_OptOut";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
				IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_OptOut
		/// <summary>
		/// spCAMPAIGNS_OptOut
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_OptOut(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_OptOut";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parRELATED_ID       = Sql.CreateParameter(cmd, "@RELATED_ID"      , "Guid",  16);
			IDbDataParameter parRELATED_TYPE     = Sql.CreateParameter(cmd, "@RELATED_TYPE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_SendEmail
		/// <summary>
		/// spCAMPAIGNS_SendEmail
		/// </summary>
		public static void spCAMPAIGNS_SendEmail(Guid gID, bool bTEST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_SendEmail";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTEST             = Sql.AddParameter(cmd, "@TEST"            , bTEST              );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_SendEmail
		/// <summary>
		/// spCAMPAIGNS_SendEmail
		/// </summary>
		public static void spCAMPAIGNS_SendEmail(Guid gID, bool bTEST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_SendEmail";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTEST             = Sql.AddParameter(cmd, "@TEST"            , bTEST              );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCAMPAIGNS_SendEmail
		/// <summary>
		/// spCAMPAIGNS_SendEmail
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_SendEmail(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_SendEmail";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTEST             = Sql.CreateParameter(cmd, "@TEST"            , "bool",   1);
			return cmd;
		}
		#endregion

		#region spCAMPAIGNS_Update
		/// <summary>
		/// spCAMPAIGNS_Update
		/// </summary>
		public static void spCAMPAIGNS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sREFER_URL, string sTRACKER_TEXT, DateTime dtSTART_DATE, DateTime dtEND_DATE, string sSTATUS, decimal dBUDGET, decimal dEXPECTED_COST, decimal dACTUAL_COST, decimal dEXPECTED_REVENUE, string sCAMPAIGN_TYPE, string sOBJECTIVE, string sCONTENT, Guid gCURRENCY_ID, Int32 nIMPRESSIONS, string sFREQUENCY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCAMPAIGNS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parREFER_URL        = Sql.AddParameter(cmd, "@REFER_URL"       , sREFER_URL         , 255);
							IDbDataParameter parTRACKER_TEXT     = Sql.AddParameter(cmd, "@TRACKER_TEXT"    , sTRACKER_TEXT      , 255);
							IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
							IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parBUDGET           = Sql.AddParameter(cmd, "@BUDGET"          , dBUDGET            );
							IDbDataParameter parEXPECTED_COST    = Sql.AddParameter(cmd, "@EXPECTED_COST"   , dEXPECTED_COST     );
							IDbDataParameter parACTUAL_COST      = Sql.AddParameter(cmd, "@ACTUAL_COST"     , dACTUAL_COST       );
							IDbDataParameter parEXPECTED_REVENUE = Sql.AddParameter(cmd, "@EXPECTED_REVENUE", dEXPECTED_REVENUE  );
							IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
							IDbDataParameter parOBJECTIVE        = Sql.AddParameter(cmd, "@OBJECTIVE"       , sOBJECTIVE         );
							IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
							IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
							IDbDataParameter parIMPRESSIONS      = Sql.AddParameter(cmd, "@IMPRESSIONS"     , nIMPRESSIONS       );
							IDbDataParameter parFREQUENCY        = Sql.AddParameter(cmd, "@FREQUENCY"       , sFREQUENCY         ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCAMPAIGNS_Update
		/// <summary>
		/// spCAMPAIGNS_Update
		/// </summary>
		public static void spCAMPAIGNS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sREFER_URL, string sTRACKER_TEXT, DateTime dtSTART_DATE, DateTime dtEND_DATE, string sSTATUS, decimal dBUDGET, decimal dEXPECTED_COST, decimal dACTUAL_COST, decimal dEXPECTED_REVENUE, string sCAMPAIGN_TYPE, string sOBJECTIVE, string sCONTENT, Guid gCURRENCY_ID, Int32 nIMPRESSIONS, string sFREQUENCY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCAMPAIGNS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parREFER_URL        = Sql.AddParameter(cmd, "@REFER_URL"       , sREFER_URL         , 255);
				IDbDataParameter parTRACKER_TEXT     = Sql.AddParameter(cmd, "@TRACKER_TEXT"    , sTRACKER_TEXT      , 255);
				IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
				IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parBUDGET           = Sql.AddParameter(cmd, "@BUDGET"          , dBUDGET            );
				IDbDataParameter parEXPECTED_COST    = Sql.AddParameter(cmd, "@EXPECTED_COST"   , dEXPECTED_COST     );
				IDbDataParameter parACTUAL_COST      = Sql.AddParameter(cmd, "@ACTUAL_COST"     , dACTUAL_COST       );
				IDbDataParameter parEXPECTED_REVENUE = Sql.AddParameter(cmd, "@EXPECTED_REVENUE", dEXPECTED_REVENUE  );
				IDbDataParameter parCAMPAIGN_TYPE    = Sql.AddParameter(cmd, "@CAMPAIGN_TYPE"   , sCAMPAIGN_TYPE     ,  25);
				IDbDataParameter parOBJECTIVE        = Sql.AddParameter(cmd, "@OBJECTIVE"       , sOBJECTIVE         );
				IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
				IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
				IDbDataParameter parIMPRESSIONS      = Sql.AddParameter(cmd, "@IMPRESSIONS"     , nIMPRESSIONS       );
				IDbDataParameter parFREQUENCY        = Sql.AddParameter(cmd, "@FREQUENCY"       , sFREQUENCY         ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCAMPAIGNS_Update
		/// <summary>
		/// spCAMPAIGNS_Update
		/// </summary>
		public static IDbCommand cmdCAMPAIGNS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCAMPAIGNS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parREFER_URL        = Sql.CreateParameter(cmd, "@REFER_URL"       , "string", 255);
			IDbDataParameter parTRACKER_TEXT     = Sql.CreateParameter(cmd, "@TRACKER_TEXT"    , "string", 255);
			IDbDataParameter parSTART_DATE       = Sql.CreateParameter(cmd, "@START_DATE"      , "DateTime",   8);
			IDbDataParameter parEND_DATE         = Sql.CreateParameter(cmd, "@END_DATE"        , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parBUDGET           = Sql.CreateParameter(cmd, "@BUDGET"          , "decimal",   8);
			IDbDataParameter parEXPECTED_COST    = Sql.CreateParameter(cmd, "@EXPECTED_COST"   , "decimal",   8);
			IDbDataParameter parACTUAL_COST      = Sql.CreateParameter(cmd, "@ACTUAL_COST"     , "decimal",   8);
			IDbDataParameter parEXPECTED_REVENUE = Sql.CreateParameter(cmd, "@EXPECTED_REVENUE", "decimal",   8);
			IDbDataParameter parCAMPAIGN_TYPE    = Sql.CreateParameter(cmd, "@CAMPAIGN_TYPE"   , "string",  25);
			IDbDataParameter parOBJECTIVE        = Sql.CreateParameter(cmd, "@OBJECTIVE"       , "string", 104857600);
			IDbDataParameter parCONTENT          = Sql.CreateParameter(cmd, "@CONTENT"         , "string", 104857600);
			IDbDataParameter parCURRENCY_ID      = Sql.CreateParameter(cmd, "@CURRENCY_ID"     , "Guid",  16);
			IDbDataParameter parIMPRESSIONS      = Sql.CreateParameter(cmd, "@IMPRESSIONS"     , "Int32",   4);
			IDbDataParameter parFREQUENCY        = Sql.CreateParameter(cmd, "@FREQUENCY"       , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCASES_BUGS_Delete
		/// <summary>
		/// spCASES_BUGS_Delete
		/// </summary>
		public static void spCASES_BUGS_Delete(Guid gCASE_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_BUGS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_BUGS_Delete
		/// <summary>
		/// spCASES_BUGS_Delete
		/// </summary>
		public static void spCASES_BUGS_Delete(Guid gCASE_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_BUGS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_BUGS_Delete
		/// <summary>
		/// spCASES_BUGS_Delete
		/// </summary>
		public static IDbCommand cmdCASES_BUGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_BUGS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_BUGS_Update
		/// <summary>
		/// spCASES_BUGS_Update
		/// </summary>
		public static void spCASES_BUGS_Update(Guid gCASE_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_BUGS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_BUGS_Update
		/// <summary>
		/// spCASES_BUGS_Update
		/// </summary>
		public static void spCASES_BUGS_Update(Guid gCASE_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_BUGS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_BUGS_Update
		/// <summary>
		/// spCASES_BUGS_Update
		/// </summary>
		public static IDbCommand cmdCASES_BUGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_BUGS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_Delete
		/// <summary>
		/// spCASES_Delete
		/// </summary>
		public static void spCASES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_Delete
		/// <summary>
		/// spCASES_Delete
		/// </summary>
		public static void spCASES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_Delete
		/// <summary>
		/// spCASES_Delete
		/// </summary>
		public static IDbCommand cmdCASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_MassDelete
		/// <summary>
		/// spCASES_MassDelete
		/// </summary>
		public static void spCASES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_MassDelete
		/// <summary>
		/// spCASES_MassDelete
		/// </summary>
		public static void spCASES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_MassDelete
		/// <summary>
		/// spCASES_MassDelete
		/// </summary>
		public static IDbCommand cmdCASES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_MassUpdate
		/// <summary>
		/// spCASES_MassUpdate
		/// </summary>
		public static void spCASES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sSTATUS, string sPRIORITY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_MassUpdate
		/// <summary>
		/// spCASES_MassUpdate
		/// </summary>
		public static void spCASES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sSTATUS, string sPRIORITY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_MassUpdate
		/// <summary>
		/// spCASES_MassUpdate
		/// </summary>
		public static IDbCommand cmdCASES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_New
		/// <summary>
		/// spCASES_New
		/// </summary>
		public static void spCASES_New(ref Guid gID, string sNAME, string sACCOUNT_NAME, Guid gACCOUNT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_New
		/// <summary>
		/// spCASES_New
		/// </summary>
		public static void spCASES_New(ref Guid gID, string sNAME, string sACCOUNT_NAME, Guid gACCOUNT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCASES_New
		/// <summary>
		/// spCASES_New
		/// </summary>
		public static IDbCommand cmdCASES_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parACCOUNT_NAME     = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"    , "string", 100);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCASES_THREADS_Delete
		/// <summary>
		/// spCASES_THREADS_Delete
		/// </summary>
		public static void spCASES_THREADS_Delete(Guid gCASE_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_THREADS_Delete
		/// <summary>
		/// spCASES_THREADS_Delete
		/// </summary>
		public static void spCASES_THREADS_Delete(Guid gCASE_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_THREADS_Delete
		/// <summary>
		/// spCASES_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdCASES_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_THREADS_Update
		/// <summary>
		/// spCASES_THREADS_Update
		/// </summary>
		public static void spCASES_THREADS_Update(Guid gCASE_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_THREADS_Update
		/// <summary>
		/// spCASES_THREADS_Update
		/// </summary>
		public static void spCASES_THREADS_Update(Guid gCASE_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCASES_THREADS_Update
		/// <summary>
		/// spCASES_THREADS_Update
		/// </summary>
		public static IDbCommand cmdCASES_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCASES_Update
		/// <summary>
		/// spCASES_Update
		/// </summary>
		public static void spCASES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sACCOUNT_NAME, Guid gACCOUNT_ID, string sSTATUS, string sPRIORITY, string sDESCRIPTION, string sRESOLUTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCASES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCASES_Update
		/// <summary>
		/// spCASES_Update
		/// </summary>
		public static void spCASES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sACCOUNT_NAME, Guid gACCOUNT_ID, string sSTATUS, string sPRIORITY, string sDESCRIPTION, string sRESOLUTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCASES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parRESOLUTION       = Sql.AddParameter(cmd, "@RESOLUTION"      , sRESOLUTION        );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCASES_Update
		/// <summary>
		/// spCASES_Update
		/// </summary>
		public static IDbCommand cmdCASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCASES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parACCOUNT_NAME     = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"    , "string", 100);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parRESOLUTION       = Sql.CreateParameter(cmd, "@RESOLUTION"      , "string", 104857600);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCONFIG_Delete
		/// <summary>
		/// spCONFIG_Delete
		/// </summary>
		public static void spCONFIG_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONFIG_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONFIG_Delete
		/// <summary>
		/// spCONFIG_Delete
		/// </summary>
		public static void spCONFIG_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONFIG_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONFIG_Delete
		/// <summary>
		/// spCONFIG_Delete
		/// </summary>
		public static IDbCommand cmdCONFIG_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONFIG_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONFIG_InsertOnly
		/// <summary>
		/// spCONFIG_InsertOnly
		/// </summary>
		public static void spCONFIG_InsertOnly(string sCATEGORY, string sNAME, string sVALUE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONFIG_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          ,  32);
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  60);
							IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , sVALUE             );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONFIG_InsertOnly
		/// <summary>
		/// spCONFIG_InsertOnly
		/// </summary>
		public static void spCONFIG_InsertOnly(string sCATEGORY, string sNAME, string sVALUE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONFIG_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          ,  32);
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  60);
				IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , sVALUE             );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONFIG_InsertOnly
		/// <summary>
		/// spCONFIG_InsertOnly
		/// </summary>
		public static IDbCommand cmdCONFIG_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONFIG_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string",  32);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  60);
			IDbDataParameter parVALUE            = Sql.CreateParameter(cmd, "@VALUE"           , "string", 104857600);
			return cmd;
		}
		#endregion

		#region spCONFIG_MassDelete
		/// <summary>
		/// spCONFIG_MassDelete
		/// </summary>
		public static void spCONFIG_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONFIG_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONFIG_MassDelete
		/// <summary>
		/// spCONFIG_MassDelete
		/// </summary>
		public static void spCONFIG_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONFIG_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONFIG_MassDelete
		/// <summary>
		/// spCONFIG_MassDelete
		/// </summary>
		public static IDbCommand cmdCONFIG_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONFIG_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONFIG_Update
		/// <summary>
		/// spCONFIG_Update
		/// </summary>
		public static void spCONFIG_Update(string sCATEGORY, string sNAME, string sVALUE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONFIG_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          ,  32);
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  60);
							IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , sVALUE             );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONFIG_Update
		/// <summary>
		/// spCONFIG_Update
		/// </summary>
		public static void spCONFIG_Update(string sCATEGORY, string sNAME, string sVALUE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONFIG_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          ,  32);
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  60);
				IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , sVALUE             );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONFIG_Update
		/// <summary>
		/// spCONFIG_Update
		/// </summary>
		public static IDbCommand cmdCONFIG_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONFIG_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string",  32);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  60);
			IDbDataParameter parVALUE            = Sql.CreateParameter(cmd, "@VALUE"           , "string", 104857600);
			return cmd;
		}
		#endregion

		#region spCONTACTS_BUGS_Delete
		/// <summary>
		/// spCONTACTS_BUGS_Delete
		/// </summary>
		public static void spCONTACTS_BUGS_Delete(Guid gCONTACT_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_BUGS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_BUGS_Delete
		/// <summary>
		/// spCONTACTS_BUGS_Delete
		/// </summary>
		public static void spCONTACTS_BUGS_Delete(Guid gCONTACT_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_BUGS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_BUGS_Delete
		/// <summary>
		/// spCONTACTS_BUGS_Delete
		/// </summary>
		public static IDbCommand cmdCONTACTS_BUGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_BUGS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_BUGS_Update
		/// <summary>
		/// spCONTACTS_BUGS_Update
		/// </summary>
		public static void spCONTACTS_BUGS_Update(Guid gCONTACT_ID, Guid gBUG_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_BUGS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_BUGS_Update
		/// <summary>
		/// spCONTACTS_BUGS_Update
		/// </summary>
		public static void spCONTACTS_BUGS_Update(Guid gCONTACT_ID, Guid gBUG_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_BUGS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_BUGS_Update
		/// <summary>
		/// spCONTACTS_BUGS_Update
		/// </summary>
		public static IDbCommand cmdCONTACTS_BUGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_BUGS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  50);
			return cmd;
		}
		#endregion

		#region spCONTACTS_CASES_Delete
		/// <summary>
		/// spCONTACTS_CASES_Delete
		/// </summary>
		public static void spCONTACTS_CASES_Delete(Guid gCONTACT_ID, Guid gCASE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_CASES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_CASES_Delete
		/// <summary>
		/// spCONTACTS_CASES_Delete
		/// </summary>
		public static void spCONTACTS_CASES_Delete(Guid gCONTACT_ID, Guid gCASE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_CASES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_CASES_Delete
		/// <summary>
		/// spCONTACTS_CASES_Delete
		/// </summary>
		public static IDbCommand cmdCONTACTS_CASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_CASES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_CASES_Update
		/// <summary>
		/// spCONTACTS_CASES_Update
		/// </summary>
		public static void spCONTACTS_CASES_Update(Guid gCONTACT_ID, Guid gCASE_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_CASES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_CASES_Update
		/// <summary>
		/// spCONTACTS_CASES_Update
		/// </summary>
		public static void spCONTACTS_CASES_Update(Guid gCONTACT_ID, Guid gCASE_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_CASES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_CASES_Update
		/// <summary>
		/// spCONTACTS_CASES_Update
		/// </summary>
		public static IDbCommand cmdCONTACTS_CASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_CASES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  50);
			return cmd;
		}
		#endregion

		#region spCONTACTS_ConvertLead
		/// <summary>
		/// spCONTACTS_ConvertLead
		/// </summary>
		public static void spCONTACTS_ConvertLead(ref Guid gID, Guid gLEAD_ID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, Guid gACCOUNT_ID, string sLEAD_SOURCE, string sTITLE, string sDEPARTMENT, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gOPPORTUNITY_ID, string sOPPORTUNITY_NAME, string sOPPORTUNITY_AMOUNT, Guid gCAMPAIGN_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_ConvertLead";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parLEAD_ID                    = Sql.AddParameter(cmd, "@LEAD_ID"                   , gLEAD_ID                     );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
							IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
							IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
							IDbDataParameter parACCOUNT_ID                 = Sql.AddParameter(cmd, "@ACCOUNT_ID"                , gACCOUNT_ID                  );
							IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
							IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  25);
							IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
							IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
							IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
							IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
							IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
							IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
							IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
							IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
							IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
							IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
							IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
							IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
							IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
							IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
							IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
							IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
							IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
							IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
							IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
							IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
							IDbDataParameter parOPPORTUNITY_ID             = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"            , gOPPORTUNITY_ID              );
							IDbDataParameter parOPPORTUNITY_NAME           = Sql.AddParameter(cmd, "@OPPORTUNITY_NAME"          , sOPPORTUNITY_NAME            , 255);
							IDbDataParameter parOPPORTUNITY_AMOUNT         = Sql.AddParameter(cmd, "@OPPORTUNITY_AMOUNT"        , sOPPORTUNITY_AMOUNT          ,  50);
							IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_ConvertLead
		/// <summary>
		/// spCONTACTS_ConvertLead
		/// </summary>
		public static void spCONTACTS_ConvertLead(ref Guid gID, Guid gLEAD_ID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, Guid gACCOUNT_ID, string sLEAD_SOURCE, string sTITLE, string sDEPARTMENT, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gOPPORTUNITY_ID, string sOPPORTUNITY_NAME, string sOPPORTUNITY_AMOUNT, Guid gCAMPAIGN_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_ConvertLead";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parLEAD_ID                    = Sql.AddParameter(cmd, "@LEAD_ID"                   , gLEAD_ID                     );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
				IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
				IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
				IDbDataParameter parACCOUNT_ID                 = Sql.AddParameter(cmd, "@ACCOUNT_ID"                , gACCOUNT_ID                  );
				IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
				IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  25);
				IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
				IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
				IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
				IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
				IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
				IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
				IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
				IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
				IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
				IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
				IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
				IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
				IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
				IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
				IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
				IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
				IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
				IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
				IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
				IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
				IDbDataParameter parOPPORTUNITY_ID             = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"            , gOPPORTUNITY_ID              );
				IDbDataParameter parOPPORTUNITY_NAME           = Sql.AddParameter(cmd, "@OPPORTUNITY_NAME"          , sOPPORTUNITY_NAME            , 255);
				IDbDataParameter parOPPORTUNITY_AMOUNT         = Sql.AddParameter(cmd, "@OPPORTUNITY_AMOUNT"        , sOPPORTUNITY_AMOUNT          ,  50);
				IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCONTACTS_ConvertLead
		/// <summary>
		/// spCONTACTS_ConvertLead
		/// </summary>
		public static IDbCommand cmdCONTACTS_ConvertLead(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_ConvertLead";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parLEAD_ID                    = Sql.CreateParameter(cmd, "@LEAD_ID"                   , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parSALUTATION                 = Sql.CreateParameter(cmd, "@SALUTATION"                , "string",   5);
			IDbDataParameter parFIRST_NAME                 = Sql.CreateParameter(cmd, "@FIRST_NAME"                , "string", 100);
			IDbDataParameter parLAST_NAME                  = Sql.CreateParameter(cmd, "@LAST_NAME"                 , "string", 100);
			IDbDataParameter parACCOUNT_ID                 = Sql.CreateParameter(cmd, "@ACCOUNT_ID"                , "Guid",  16);
			IDbDataParameter parLEAD_SOURCE                = Sql.CreateParameter(cmd, "@LEAD_SOURCE"               , "string", 100);
			IDbDataParameter parTITLE                      = Sql.CreateParameter(cmd, "@TITLE"                     , "string",  25);
			IDbDataParameter parDEPARTMENT                 = Sql.CreateParameter(cmd, "@DEPARTMENT"                , "string", 100);
			IDbDataParameter parDO_NOT_CALL                = Sql.CreateParameter(cmd, "@DO_NOT_CALL"               , "bool",   1);
			IDbDataParameter parPHONE_HOME                 = Sql.CreateParameter(cmd, "@PHONE_HOME"                , "string",  25);
			IDbDataParameter parPHONE_MOBILE               = Sql.CreateParameter(cmd, "@PHONE_MOBILE"              , "string",  25);
			IDbDataParameter parPHONE_WORK                 = Sql.CreateParameter(cmd, "@PHONE_WORK"                , "string",  25);
			IDbDataParameter parPHONE_OTHER                = Sql.CreateParameter(cmd, "@PHONE_OTHER"               , "string",  25);
			IDbDataParameter parPHONE_FAX                  = Sql.CreateParameter(cmd, "@PHONE_FAX"                 , "string",  25);
			IDbDataParameter parEMAIL1                     = Sql.CreateParameter(cmd, "@EMAIL1"                    , "string", 100);
			IDbDataParameter parEMAIL2                     = Sql.CreateParameter(cmd, "@EMAIL2"                    , "string", 100);
			IDbDataParameter parEMAIL_OPT_OUT              = Sql.CreateParameter(cmd, "@EMAIL_OPT_OUT"             , "bool",   1);
			IDbDataParameter parINVALID_EMAIL              = Sql.CreateParameter(cmd, "@INVALID_EMAIL"             , "bool",   1);
			IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parALT_ADDRESS_STREET         = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STREET"        , "string", 150);
			IDbDataParameter parALT_ADDRESS_CITY           = Sql.CreateParameter(cmd, "@ALT_ADDRESS_CITY"          , "string", 100);
			IDbDataParameter parALT_ADDRESS_STATE          = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STATE"         , "string", 100);
			IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.CreateParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , "string",  20);
			IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.CreateParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , "string", 100);
			IDbDataParameter parDESCRIPTION                = Sql.CreateParameter(cmd, "@DESCRIPTION"               , "string", 104857600);
			IDbDataParameter parOPPORTUNITY_ID             = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"            , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_NAME           = Sql.CreateParameter(cmd, "@OPPORTUNITY_NAME"          , "string", 255);
			IDbDataParameter parOPPORTUNITY_AMOUNT         = Sql.CreateParameter(cmd, "@OPPORTUNITY_AMOUNT"        , "string",  50);
			IDbDataParameter parCAMPAIGN_ID                = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"               , "Guid",  16);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCONTACTS_Delete
		/// <summary>
		/// spCONTACTS_Delete
		/// </summary>
		public static void spCONTACTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_Delete
		/// <summary>
		/// spCONTACTS_Delete
		/// </summary>
		public static void spCONTACTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_Delete
		/// <summary>
		/// spCONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_MassDelete
		/// <summary>
		/// spCONTACTS_MassDelete
		/// </summary>
		public static void spCONTACTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_MassDelete
		/// <summary>
		/// spCONTACTS_MassDelete
		/// </summary>
		public static void spCONTACTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_MassDelete
		/// <summary>
		/// spCONTACTS_MassDelete
		/// </summary>
		public static IDbCommand cmdCONTACTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_MassSync
		/// <summary>
		/// spCONTACTS_MassSync
		/// </summary>
		public static void spCONTACTS_MassSync(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_MassSync";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_MassSync
		/// <summary>
		/// spCONTACTS_MassSync
		/// </summary>
		public static void spCONTACTS_MassSync(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_MassSync";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_MassSync
		/// <summary>
		/// spCONTACTS_MassSync
		/// </summary>
		public static IDbCommand cmdCONTACTS_MassSync(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_MassSync";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_MassUnsync
		/// <summary>
		/// spCONTACTS_MassUnsync
		/// </summary>
		public static void spCONTACTS_MassUnsync(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_MassUnsync";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_MassUnsync
		/// <summary>
		/// spCONTACTS_MassUnsync
		/// </summary>
		public static void spCONTACTS_MassUnsync(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_MassUnsync";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_MassUnsync
		/// <summary>
		/// spCONTACTS_MassUnsync
		/// </summary>
		public static IDbCommand cmdCONTACTS_MassUnsync(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_MassUnsync";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_MassUpdate
		/// <summary>
		/// spCONTACTS_MassUpdate
		/// </summary>
		public static void spCONTACTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sLEAD_SOURCE, Guid gREPORTS_TO_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       , 100);
							IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_MassUpdate
		/// <summary>
		/// spCONTACTS_MassUpdate
		/// </summary>
		public static void spCONTACTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sLEAD_SOURCE, Guid gREPORTS_TO_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       , 100);
				IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_MassUpdate
		/// <summary>
		/// spCONTACTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdCONTACTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parLEAD_SOURCE      = Sql.CreateParameter(cmd, "@LEAD_SOURCE"     , "string", 100);
			IDbDataParameter parREPORTS_TO_ID    = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"   , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_New
		/// <summary>
		/// spCONTACTS_New
		/// </summary>
		public static void spCONTACTS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
							IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
							IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
							IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_New
		/// <summary>
		/// spCONTACTS_New
		/// </summary>
		public static void spCONTACTS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
				IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
				IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
				IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCONTACTS_New
		/// <summary>
		/// spCONTACTS_New
		/// </summary>
		public static IDbCommand cmdCONTACTS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFIRST_NAME       = Sql.CreateParameter(cmd, "@FIRST_NAME"      , "string", 100);
			IDbDataParameter parLAST_NAME        = Sql.CreateParameter(cmd, "@LAST_NAME"       , "string", 100);
			IDbDataParameter parPHONE_WORK       = Sql.CreateParameter(cmd, "@PHONE_WORK"      , "string",  25);
			IDbDataParameter parEMAIL1           = Sql.CreateParameter(cmd, "@EMAIL1"          , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCONTACTS_REPORTS_TO_Update
		/// <summary>
		/// spCONTACTS_REPORTS_TO_Update
		/// </summary>
		public static void spCONTACTS_REPORTS_TO_Update(Guid gCONTACT_ID, Guid gREPORTS_TO_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_REPORTS_TO_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_REPORTS_TO_Update
		/// <summary>
		/// spCONTACTS_REPORTS_TO_Update
		/// </summary>
		public static void spCONTACTS_REPORTS_TO_Update(Guid gCONTACT_ID, Guid gREPORTS_TO_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_REPORTS_TO_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_REPORTS_TO_Update
		/// <summary>
		/// spCONTACTS_REPORTS_TO_Update
		/// </summary>
		public static IDbCommand cmdCONTACTS_REPORTS_TO_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_REPORTS_TO_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parREPORTS_TO_ID    = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"   , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_Update
		/// <summary>
		/// spCONTACTS_Update
		/// </summary>
		public static void spCONTACTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, Guid gACCOUNT_ID, string sLEAD_SOURCE, string sTITLE, string sDEPARTMENT, Guid gREPORTS_TO_ID, DateTime dtBIRTHDATE, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sASSISTANT, string sASSISTANT_PHONE, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, bool bSYNC_CONTACT, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_Update";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
							IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
							IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
							IDbDataParameter parACCOUNT_ID                 = Sql.AddParameter(cmd, "@ACCOUNT_ID"                , gACCOUNT_ID                  );
							IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
							IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  50);
							IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
							IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
							IDbDataParameter parBIRTHDATE                  = Sql.AddParameter(cmd, "@BIRTHDATE"                 , dtBIRTHDATE                  );
							IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
							IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
							IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
							IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
							IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
							IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
							IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
							IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
							IDbDataParameter parASSISTANT                  = Sql.AddParameter(cmd, "@ASSISTANT"                 , sASSISTANT                   ,  75);
							IDbDataParameter parASSISTANT_PHONE            = Sql.AddParameter(cmd, "@ASSISTANT_PHONE"           , sASSISTANT_PHONE             ,  25);
							IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
							IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
							IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
							IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
							IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
							IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
							IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
							IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
							IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
							IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
							IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
							IDbDataParameter parPARENT_TYPE                = Sql.AddParameter(cmd, "@PARENT_TYPE"               , sPARENT_TYPE                 ,  25);
							IDbDataParameter parPARENT_ID                  = Sql.AddParameter(cmd, "@PARENT_ID"                 , gPARENT_ID                   );
							IDbDataParameter parSYNC_CONTACT               = Sql.AddParameter(cmd, "@SYNC_CONTACT"              , bSYNC_CONTACT                );
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_Update
		/// <summary>
		/// spCONTACTS_Update
		/// </summary>
		public static void spCONTACTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, Guid gACCOUNT_ID, string sLEAD_SOURCE, string sTITLE, string sDEPARTMENT, Guid gREPORTS_TO_ID, DateTime dtBIRTHDATE, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sASSISTANT, string sASSISTANT_PHONE, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, bool bSYNC_CONTACT, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_Update";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
				IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
				IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
				IDbDataParameter parACCOUNT_ID                 = Sql.AddParameter(cmd, "@ACCOUNT_ID"                , gACCOUNT_ID                  );
				IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
				IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  50);
				IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
				IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
				IDbDataParameter parBIRTHDATE                  = Sql.AddParameter(cmd, "@BIRTHDATE"                 , dtBIRTHDATE                  );
				IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
				IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
				IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
				IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
				IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
				IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
				IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
				IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
				IDbDataParameter parASSISTANT                  = Sql.AddParameter(cmd, "@ASSISTANT"                 , sASSISTANT                   ,  75);
				IDbDataParameter parASSISTANT_PHONE            = Sql.AddParameter(cmd, "@ASSISTANT_PHONE"           , sASSISTANT_PHONE             ,  25);
				IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
				IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
				IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
				IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
				IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
				IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
				IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
				IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
				IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
				IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
				IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
				IDbDataParameter parPARENT_TYPE                = Sql.AddParameter(cmd, "@PARENT_TYPE"               , sPARENT_TYPE                 ,  25);
				IDbDataParameter parPARENT_ID                  = Sql.AddParameter(cmd, "@PARENT_ID"                 , gPARENT_ID                   );
				IDbDataParameter parSYNC_CONTACT               = Sql.AddParameter(cmd, "@SYNC_CONTACT"              , bSYNC_CONTACT                );
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCONTACTS_Update
		/// <summary>
		/// spCONTACTS_Update
		/// </summary>
		public static IDbCommand cmdCONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_Update";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parSALUTATION                 = Sql.CreateParameter(cmd, "@SALUTATION"                , "string",   5);
			IDbDataParameter parFIRST_NAME                 = Sql.CreateParameter(cmd, "@FIRST_NAME"                , "string", 100);
			IDbDataParameter parLAST_NAME                  = Sql.CreateParameter(cmd, "@LAST_NAME"                 , "string", 100);
			IDbDataParameter parACCOUNT_ID                 = Sql.CreateParameter(cmd, "@ACCOUNT_ID"                , "Guid",  16);
			IDbDataParameter parLEAD_SOURCE                = Sql.CreateParameter(cmd, "@LEAD_SOURCE"               , "string", 100);
			IDbDataParameter parTITLE                      = Sql.CreateParameter(cmd, "@TITLE"                     , "string",  50);
			IDbDataParameter parDEPARTMENT                 = Sql.CreateParameter(cmd, "@DEPARTMENT"                , "string", 100);
			IDbDataParameter parREPORTS_TO_ID              = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"             , "Guid",  16);
			IDbDataParameter parBIRTHDATE                  = Sql.CreateParameter(cmd, "@BIRTHDATE"                 , "DateTime",   8);
			IDbDataParameter parDO_NOT_CALL                = Sql.CreateParameter(cmd, "@DO_NOT_CALL"               , "bool",   1);
			IDbDataParameter parPHONE_HOME                 = Sql.CreateParameter(cmd, "@PHONE_HOME"                , "string",  25);
			IDbDataParameter parPHONE_MOBILE               = Sql.CreateParameter(cmd, "@PHONE_MOBILE"              , "string",  25);
			IDbDataParameter parPHONE_WORK                 = Sql.CreateParameter(cmd, "@PHONE_WORK"                , "string",  25);
			IDbDataParameter parPHONE_OTHER                = Sql.CreateParameter(cmd, "@PHONE_OTHER"               , "string",  25);
			IDbDataParameter parPHONE_FAX                  = Sql.CreateParameter(cmd, "@PHONE_FAX"                 , "string",  25);
			IDbDataParameter parEMAIL1                     = Sql.CreateParameter(cmd, "@EMAIL1"                    , "string", 100);
			IDbDataParameter parEMAIL2                     = Sql.CreateParameter(cmd, "@EMAIL2"                    , "string", 100);
			IDbDataParameter parASSISTANT                  = Sql.CreateParameter(cmd, "@ASSISTANT"                 , "string",  75);
			IDbDataParameter parASSISTANT_PHONE            = Sql.CreateParameter(cmd, "@ASSISTANT_PHONE"           , "string",  25);
			IDbDataParameter parEMAIL_OPT_OUT              = Sql.CreateParameter(cmd, "@EMAIL_OPT_OUT"             , "bool",   1);
			IDbDataParameter parINVALID_EMAIL              = Sql.CreateParameter(cmd, "@INVALID_EMAIL"             , "bool",   1);
			IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parALT_ADDRESS_STREET         = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STREET"        , "string", 150);
			IDbDataParameter parALT_ADDRESS_CITY           = Sql.CreateParameter(cmd, "@ALT_ADDRESS_CITY"          , "string", 100);
			IDbDataParameter parALT_ADDRESS_STATE          = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STATE"         , "string", 100);
			IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.CreateParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , "string",  20);
			IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.CreateParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , "string", 100);
			IDbDataParameter parDESCRIPTION                = Sql.CreateParameter(cmd, "@DESCRIPTION"               , "string", 104857600);
			IDbDataParameter parPARENT_TYPE                = Sql.CreateParameter(cmd, "@PARENT_TYPE"               , "string",  25);
			IDbDataParameter parPARENT_ID                  = Sql.CreateParameter(cmd, "@PARENT_ID"                 , "Guid",  16);
			IDbDataParameter parSYNC_CONTACT               = Sql.CreateParameter(cmd, "@SYNC_CONTACT"              , "bool",   1);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCONTACTS_USERS_Delete
		/// <summary>
		/// spCONTACTS_USERS_Delete
		/// </summary>
		public static void spCONTACTS_USERS_Delete(Guid gCONTACT_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_USERS_Delete
		/// <summary>
		/// spCONTACTS_USERS_Delete
		/// </summary>
		public static void spCONTACTS_USERS_Delete(Guid gCONTACT_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_USERS_Delete
		/// <summary>
		/// spCONTACTS_USERS_Delete
		/// </summary>
		public static IDbCommand cmdCONTACTS_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTACTS_USERS_Update
		/// <summary>
		/// spCONTACTS_USERS_Update
		/// </summary>
		public static void spCONTACTS_USERS_Update(Guid gCONTACT_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTACTS_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTACTS_USERS_Update
		/// <summary>
		/// spCONTACTS_USERS_Update
		/// </summary>
		public static void spCONTACTS_USERS_Update(Guid gCONTACT_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTACTS_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTACTS_USERS_Update
		/// <summary>
		/// spCONTACTS_USERS_Update
		/// </summary>
		public static IDbCommand cmdCONTACTS_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTACTS_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACT_TYPES_Delete
		/// <summary>
		/// spCONTRACT_TYPES_Delete
		/// </summary>
		public static void spCONTRACT_TYPES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACT_TYPES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACT_TYPES_Delete
		/// <summary>
		/// spCONTRACT_TYPES_Delete
		/// </summary>
		public static void spCONTRACT_TYPES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACT_TYPES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACT_TYPES_Delete
		/// <summary>
		/// spCONTRACT_TYPES_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACT_TYPES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACT_TYPES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACT_TYPES_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Delete
		/// </summary>
		public static void spCONTRACT_TYPES_DOCUMENTS_Delete(Guid gCONTRACT_TYPE_ID, Guid gDOCUMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Del";
							else
								cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_TYPE_ID = Sql.AddParameter(cmd, "@CONTRACT_TYPE_ID", gCONTRACT_TYPE_ID  );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACT_TYPES_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Delete
		/// </summary>
		public static void spCONTRACT_TYPES_DOCUMENTS_Delete(Guid gCONTRACT_TYPE_ID, Guid gDOCUMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Del";
				else
					cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_TYPE_ID = Sql.AddParameter(cmd, "@CONTRACT_TYPE_ID", gCONTRACT_TYPE_ID  );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACT_TYPES_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACT_TYPES_DOCUMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Del";
			else
				cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_TYPE_ID = Sql.CreateParameter(cmd, "@CONTRACT_TYPE_ID", "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACT_TYPES_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Update
		/// </summary>
		public static void spCONTRACT_TYPES_DOCUMENTS_Update(Guid gCONTRACT_TYPE_ID, Guid gDOCUMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Upd";
							else
								cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_TYPE_ID = Sql.AddParameter(cmd, "@CONTRACT_TYPE_ID", gCONTRACT_TYPE_ID  );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACT_TYPES_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Update
		/// </summary>
		public static void spCONTRACT_TYPES_DOCUMENTS_Update(Guid gCONTRACT_TYPE_ID, Guid gDOCUMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Upd";
				else
					cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_TYPE_ID = Sql.AddParameter(cmd, "@CONTRACT_TYPE_ID", gCONTRACT_TYPE_ID  );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACT_TYPES_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACT_TYPES_DOCUMENTS_Update
		/// </summary>
		public static IDbCommand cmdCONTRACT_TYPES_DOCUMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Upd";
			else
				cmd.CommandText = "spCONTRACT_TYPES_DOCUMENTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_TYPE_ID = Sql.CreateParameter(cmd, "@CONTRACT_TYPE_ID", "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACT_TYPES_Update
		/// <summary>
		/// spCONTRACT_TYPES_Update
		/// </summary>
		public static void spCONTRACT_TYPES_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACT_TYPES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 100);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACT_TYPES_Update
		/// <summary>
		/// spCONTRACT_TYPES_Update
		/// </summary>
		public static void spCONTRACT_TYPES_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACT_TYPES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 100);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCONTRACT_TYPES_Update
		/// <summary>
		/// spCONTRACT_TYPES_Update
		/// </summary>
		public static IDbCommand cmdCONTRACT_TYPES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACT_TYPES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 100);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCONTRACTS_CONTACTS_Delete
		/// <summary>
		/// spCONTRACTS_CONTACTS_Delete
		/// </summary>
		public static void spCONTRACTS_CONTACTS_Delete(Guid gCONTRACT_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_CONTACTS_Delete
		/// <summary>
		/// spCONTRACTS_CONTACTS_Delete
		/// </summary>
		public static void spCONTRACTS_CONTACTS_Delete(Guid gCONTRACT_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_CONTACTS_Delete
		/// <summary>
		/// spCONTRACTS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_CONTACTS_Update
		/// <summary>
		/// spCONTRACTS_CONTACTS_Update
		/// </summary>
		public static void spCONTRACTS_CONTACTS_Update(Guid gCONTRACT_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_CONTACTS_Update
		/// <summary>
		/// spCONTRACTS_CONTACTS_Update
		/// </summary>
		public static void spCONTRACTS_CONTACTS_Update(Guid gCONTRACT_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_CONTACTS_Update
		/// <summary>
		/// spCONTRACTS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_Delete
		/// <summary>
		/// spCONTRACTS_Delete
		/// </summary>
		public static void spCONTRACTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_Delete
		/// <summary>
		/// spCONTRACTS_Delete
		/// </summary>
		public static void spCONTRACTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_Delete
		/// <summary>
		/// spCONTRACTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Delete
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_Delete(Guid gCONTRACT_ID, Guid gDOCUMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_DOCUMENTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Delete
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_Delete(Guid gCONTRACT_ID, Guid gDOCUMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_DOCUMENTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_DOCUMENTS_Delete
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_DOCUMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_DOCUMENTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_GetLatest
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_GetLatest
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_GetLatest(Guid gCONTRACT_ID, Guid gDOCUMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLates";
							else
								cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLatest";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_GetLatest
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_GetLatest
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_GetLatest(Guid gCONTRACT_ID, Guid gDOCUMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLates";
				else
					cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLatest";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_DOCUMENTS_GetLatest
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_GetLatest
		/// </summary>
		public static IDbCommand cmdCONTRACTS_DOCUMENTS_GetLatest(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLates";
			else
				cmd.CommandText = "spCONTRACTS_DOCUMENTS_GetLatest";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Update
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_Update(Guid gCONTRACT_ID, Guid gDOCUMENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_DOCUMENTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Update
		/// </summary>
		public static void spCONTRACTS_DOCUMENTS_Update(Guid gCONTRACT_ID, Guid gDOCUMENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_DOCUMENTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_DOCUMENTS_Update
		/// <summary>
		/// spCONTRACTS_DOCUMENTS_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_DOCUMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_DOCUMENTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_MassDelete
		/// <summary>
		/// spCONTRACTS_MassDelete
		/// </summary>
		public static void spCONTRACTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_MassDelete
		/// <summary>
		/// spCONTRACTS_MassDelete
		/// </summary>
		public static void spCONTRACTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_MassDelete
		/// <summary>
		/// spCONTRACTS_MassDelete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_MassUpdate
		/// <summary>
		/// spCONTRACTS_MassUpdate
		/// </summary>
		public static void spCONTRACTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sSTATUS, DateTime dtSTART_DATE, DateTime dtEND_DATE, DateTime dtCOMPANY_SIGNED_DATE, DateTime dtCUSTOMER_SIGNED_DATE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_MassUpdate";
							IDbDataParameter parID_LIST              = Sql.AddAnsiParam(cmd, "@ID_LIST"             , sID_LIST               , 8000);
							IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
							IDbDataParameter parASSIGNED_USER_ID     = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"    , gASSIGNED_USER_ID      );
							IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
							IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
							IDbDataParameter parSTART_DATE           = Sql.AddParameter(cmd, "@START_DATE"          , dtSTART_DATE           );
							IDbDataParameter parEND_DATE             = Sql.AddParameter(cmd, "@END_DATE"            , dtEND_DATE             );
							IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.AddParameter(cmd, "@COMPANY_SIGNED_DATE" , dtCOMPANY_SIGNED_DATE  );
							IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.AddParameter(cmd, "@CUSTOMER_SIGNED_DATE", dtCUSTOMER_SIGNED_DATE );
							IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_MassUpdate
		/// <summary>
		/// spCONTRACTS_MassUpdate
		/// </summary>
		public static void spCONTRACTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sSTATUS, DateTime dtSTART_DATE, DateTime dtEND_DATE, DateTime dtCOMPANY_SIGNED_DATE, DateTime dtCUSTOMER_SIGNED_DATE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_MassUpdate";
				IDbDataParameter parID_LIST              = Sql.AddAnsiParam(cmd, "@ID_LIST"             , sID_LIST               , 8000);
				IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
				IDbDataParameter parASSIGNED_USER_ID     = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"    , gASSIGNED_USER_ID      );
				IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
				IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
				IDbDataParameter parSTART_DATE           = Sql.AddParameter(cmd, "@START_DATE"          , dtSTART_DATE           );
				IDbDataParameter parEND_DATE             = Sql.AddParameter(cmd, "@END_DATE"            , dtEND_DATE             );
				IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.AddParameter(cmd, "@COMPANY_SIGNED_DATE" , dtCOMPANY_SIGNED_DATE  );
				IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.AddParameter(cmd, "@CUSTOMER_SIGNED_DATE", dtCUSTOMER_SIGNED_DATE );
				IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_MassUpdate
		/// <summary>
		/// spCONTRACTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdCONTRACTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_MassUpdate";
			IDbDataParameter parID_LIST              = Sql.CreateParameter(cmd, "@ID_LIST"             , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID     = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"    , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID     = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"    , "Guid",  16);
			IDbDataParameter parACCOUNT_ID           = Sql.CreateParameter(cmd, "@ACCOUNT_ID"          , "Guid",  16);
			IDbDataParameter parSTATUS               = Sql.CreateParameter(cmd, "@STATUS"              , "string",  25);
			IDbDataParameter parSTART_DATE           = Sql.CreateParameter(cmd, "@START_DATE"          , "DateTime",   8);
			IDbDataParameter parEND_DATE             = Sql.CreateParameter(cmd, "@END_DATE"            , "DateTime",   8);
			IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.CreateParameter(cmd, "@COMPANY_SIGNED_DATE" , "DateTime",   8);
			IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.CreateParameter(cmd, "@CUSTOMER_SIGNED_DATE", "DateTime",   8);
			IDbDataParameter parTEAM_ID              = Sql.CreateParameter(cmd, "@TEAM_ID"             , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spCONTRACTS_OPPORTUNITIES_Delete(Guid gCONTRACT_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Dele";
							else
								cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spCONTRACTS_OPPORTUNITIES_Delete(Guid gCONTRACT_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Dele";
				else
					cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Dele";
			else
				cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_OPPORTUNITIES_Update
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spCONTRACTS_OPPORTUNITIES_Update(Guid gCONTRACT_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Upda";
							else
								cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_OPPORTUNITIES_Update
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spCONTRACTS_OPPORTUNITIES_Update(Guid gCONTRACT_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Upda";
				else
					cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_OPPORTUNITIES_Update
		/// <summary>
		/// spCONTRACTS_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Upda";
			else
				cmd.CommandText = "spCONTRACTS_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_PRODUCTS_Delete
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Delete
		/// </summary>
		public static void spCONTRACTS_PRODUCTS_Delete(Guid gCONTRACT_ID, Guid gPRODUCT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_PRODUCTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parPRODUCT_ID       = Sql.AddParameter(cmd, "@PRODUCT_ID"      , gPRODUCT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_PRODUCTS_Delete
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Delete
		/// </summary>
		public static void spCONTRACTS_PRODUCTS_Delete(Guid gCONTRACT_ID, Guid gPRODUCT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_PRODUCTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parPRODUCT_ID       = Sql.AddParameter(cmd, "@PRODUCT_ID"      , gPRODUCT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_PRODUCTS_Delete
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_PRODUCTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_PRODUCTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parPRODUCT_ID       = Sql.CreateParameter(cmd, "@PRODUCT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_PRODUCTS_Update
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Update
		/// </summary>
		public static void spCONTRACTS_PRODUCTS_Update(Guid gCONTRACT_ID, Guid gPRODUCT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_PRODUCTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parPRODUCT_ID       = Sql.AddParameter(cmd, "@PRODUCT_ID"      , gPRODUCT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_PRODUCTS_Update
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Update
		/// </summary>
		public static void spCONTRACTS_PRODUCTS_Update(Guid gCONTRACT_ID, Guid gPRODUCT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_PRODUCTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parPRODUCT_ID       = Sql.AddParameter(cmd, "@PRODUCT_ID"      , gPRODUCT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_PRODUCTS_Update
		/// <summary>
		/// spCONTRACTS_PRODUCTS_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_PRODUCTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_PRODUCTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parPRODUCT_ID       = Sql.CreateParameter(cmd, "@PRODUCT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_QUOTES_Delete
		/// <summary>
		/// spCONTRACTS_QUOTES_Delete
		/// </summary>
		public static void spCONTRACTS_QUOTES_Delete(Guid gCONTRACT_ID, Guid gQUOTE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_QUOTES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_QUOTES_Delete
		/// <summary>
		/// spCONTRACTS_QUOTES_Delete
		/// </summary>
		public static void spCONTRACTS_QUOTES_Delete(Guid gCONTRACT_ID, Guid gQUOTE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_QUOTES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_QUOTES_Delete
		/// <summary>
		/// spCONTRACTS_QUOTES_Delete
		/// </summary>
		public static IDbCommand cmdCONTRACTS_QUOTES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_QUOTES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_QUOTES_Update
		/// <summary>
		/// spCONTRACTS_QUOTES_Update
		/// </summary>
		public static void spCONTRACTS_QUOTES_Update(Guid gCONTRACT_ID, Guid gQUOTE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_QUOTES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_QUOTES_Update
		/// <summary>
		/// spCONTRACTS_QUOTES_Update
		/// </summary>
		public static void spCONTRACTS_QUOTES_Update(Guid gCONTRACT_ID, Guid gQUOTE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_QUOTES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCONTRACT_ID      = Sql.AddParameter(cmd, "@CONTRACT_ID"     , gCONTRACT_ID       );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCONTRACTS_QUOTES_Update
		/// <summary>
		/// spCONTRACTS_QUOTES_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_QUOTES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_QUOTES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCONTRACT_ID      = Sql.CreateParameter(cmd, "@CONTRACT_ID"     , "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCONTRACTS_Update
		/// <summary>
		/// spCONTRACTS_Update
		/// </summary>
		public static void spCONTRACTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sREFERENCE_CODE, string sSTATUS, Guid gTYPE_ID, Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, DateTime dtCOMPANY_SIGNED_DATE, DateTime dtCUSTOMER_SIGNED_DATE, DateTime dtEXPIRATION_NOTICE, Guid gCURRENCY_ID, decimal dTOTAL_CONTRACT_VALUE, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCONTRACTS_Update";
							IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
							IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
							IDbDataParameter parASSIGNED_USER_ID     = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"    , gASSIGNED_USER_ID      );
							IDbDataParameter parNAME                 = Sql.AddParameter(cmd, "@NAME"                , sNAME                  , 255);
							IDbDataParameter parREFERENCE_CODE       = Sql.AddParameter(cmd, "@REFERENCE_CODE"      , sREFERENCE_CODE        , 255);
							IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
							IDbDataParameter parTYPE_ID              = Sql.AddParameter(cmd, "@TYPE_ID"             , gTYPE_ID               );
							IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
							IDbDataParameter parOPPORTUNITY_ID       = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"      , gOPPORTUNITY_ID        );
							IDbDataParameter parSTART_DATE           = Sql.AddParameter(cmd, "@START_DATE"          , dtSTART_DATE           );
							IDbDataParameter parEND_DATE             = Sql.AddParameter(cmd, "@END_DATE"            , dtEND_DATE             );
							IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.AddParameter(cmd, "@COMPANY_SIGNED_DATE" , dtCOMPANY_SIGNED_DATE  );
							IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.AddParameter(cmd, "@CUSTOMER_SIGNED_DATE", dtCUSTOMER_SIGNED_DATE );
							IDbDataParameter parEXPIRATION_NOTICE    = Sql.AddParameter(cmd, "@EXPIRATION_NOTICE"   , dtEXPIRATION_NOTICE    );
							IDbDataParameter parCURRENCY_ID          = Sql.AddParameter(cmd, "@CURRENCY_ID"         , gCURRENCY_ID           );
							IDbDataParameter parTOTAL_CONTRACT_VALUE = Sql.AddParameter(cmd, "@TOTAL_CONTRACT_VALUE", dTOTAL_CONTRACT_VALUE  );
							IDbDataParameter parDESCRIPTION          = Sql.AddParameter(cmd, "@DESCRIPTION"         , sDESCRIPTION           );
							IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCONTRACTS_Update
		/// <summary>
		/// spCONTRACTS_Update
		/// </summary>
		public static void spCONTRACTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sREFERENCE_CODE, string sSTATUS, Guid gTYPE_ID, Guid gACCOUNT_ID, Guid gOPPORTUNITY_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, DateTime dtCOMPANY_SIGNED_DATE, DateTime dtCUSTOMER_SIGNED_DATE, DateTime dtEXPIRATION_NOTICE, Guid gCURRENCY_ID, decimal dTOTAL_CONTRACT_VALUE, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCONTRACTS_Update";
				IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
				IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
				IDbDataParameter parASSIGNED_USER_ID     = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"    , gASSIGNED_USER_ID      );
				IDbDataParameter parNAME                 = Sql.AddParameter(cmd, "@NAME"                , sNAME                  , 255);
				IDbDataParameter parREFERENCE_CODE       = Sql.AddParameter(cmd, "@REFERENCE_CODE"      , sREFERENCE_CODE        , 255);
				IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
				IDbDataParameter parTYPE_ID              = Sql.AddParameter(cmd, "@TYPE_ID"             , gTYPE_ID               );
				IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
				IDbDataParameter parOPPORTUNITY_ID       = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"      , gOPPORTUNITY_ID        );
				IDbDataParameter parSTART_DATE           = Sql.AddParameter(cmd, "@START_DATE"          , dtSTART_DATE           );
				IDbDataParameter parEND_DATE             = Sql.AddParameter(cmd, "@END_DATE"            , dtEND_DATE             );
				IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.AddParameter(cmd, "@COMPANY_SIGNED_DATE" , dtCOMPANY_SIGNED_DATE  );
				IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.AddParameter(cmd, "@CUSTOMER_SIGNED_DATE", dtCUSTOMER_SIGNED_DATE );
				IDbDataParameter parEXPIRATION_NOTICE    = Sql.AddParameter(cmd, "@EXPIRATION_NOTICE"   , dtEXPIRATION_NOTICE    );
				IDbDataParameter parCURRENCY_ID          = Sql.AddParameter(cmd, "@CURRENCY_ID"         , gCURRENCY_ID           );
				IDbDataParameter parTOTAL_CONTRACT_VALUE = Sql.AddParameter(cmd, "@TOTAL_CONTRACT_VALUE", dTOTAL_CONTRACT_VALUE  );
				IDbDataParameter parDESCRIPTION          = Sql.AddParameter(cmd, "@DESCRIPTION"         , sDESCRIPTION           );
				IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCONTRACTS_Update
		/// <summary>
		/// spCONTRACTS_Update
		/// </summary>
		public static IDbCommand cmdCONTRACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCONTRACTS_Update";
			IDbDataParameter parID                   = Sql.CreateParameter(cmd, "@ID"                  , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID     = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"    , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID     = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"    , "Guid",  16);
			IDbDataParameter parNAME                 = Sql.CreateParameter(cmd, "@NAME"                , "string", 255);
			IDbDataParameter parREFERENCE_CODE       = Sql.CreateParameter(cmd, "@REFERENCE_CODE"      , "string", 255);
			IDbDataParameter parSTATUS               = Sql.CreateParameter(cmd, "@STATUS"              , "string",  25);
			IDbDataParameter parTYPE_ID              = Sql.CreateParameter(cmd, "@TYPE_ID"             , "Guid",  16);
			IDbDataParameter parACCOUNT_ID           = Sql.CreateParameter(cmd, "@ACCOUNT_ID"          , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID       = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"      , "Guid",  16);
			IDbDataParameter parSTART_DATE           = Sql.CreateParameter(cmd, "@START_DATE"          , "DateTime",   8);
			IDbDataParameter parEND_DATE             = Sql.CreateParameter(cmd, "@END_DATE"            , "DateTime",   8);
			IDbDataParameter parCOMPANY_SIGNED_DATE  = Sql.CreateParameter(cmd, "@COMPANY_SIGNED_DATE" , "DateTime",   8);
			IDbDataParameter parCUSTOMER_SIGNED_DATE = Sql.CreateParameter(cmd, "@CUSTOMER_SIGNED_DATE", "DateTime",   8);
			IDbDataParameter parEXPIRATION_NOTICE    = Sql.CreateParameter(cmd, "@EXPIRATION_NOTICE"   , "DateTime",   8);
			IDbDataParameter parCURRENCY_ID          = Sql.CreateParameter(cmd, "@CURRENCY_ID"         , "Guid",  16);
			IDbDataParameter parTOTAL_CONTRACT_VALUE = Sql.CreateParameter(cmd, "@TOTAL_CONTRACT_VALUE", "decimal",   8);
			IDbDataParameter parDESCRIPTION          = Sql.CreateParameter(cmd, "@DESCRIPTION"         , "string", 104857600);
			IDbDataParameter parTEAM_ID              = Sql.CreateParameter(cmd, "@TEAM_ID"             , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCronRun
		/// <summary>
		/// spCronRun
		/// </summary>
		public static void spCronRun(string sCRON, DateTime dtCURRENT_TIME, Int32 nMINUTE_DIVISOR)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCronRun";
							IDbDataParameter parCRON           = Sql.AddParameter(cmd, "@CRON"          , sCRON            , 100);
							IDbDataParameter parCURRENT_TIME   = Sql.AddParameter(cmd, "@CURRENT_TIME"  , dtCURRENT_TIME   );
							IDbDataParameter parMINUTE_DIVISOR = Sql.AddParameter(cmd, "@MINUTE_DIVISOR", nMINUTE_DIVISOR  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCronRun
		/// <summary>
		/// spCronRun
		/// </summary>
		public static void spCronRun(string sCRON, DateTime dtCURRENT_TIME, Int32 nMINUTE_DIVISOR, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCronRun";
				IDbDataParameter parCRON           = Sql.AddParameter(cmd, "@CRON"          , sCRON            , 100);
				IDbDataParameter parCURRENT_TIME   = Sql.AddParameter(cmd, "@CURRENT_TIME"  , dtCURRENT_TIME   );
				IDbDataParameter parMINUTE_DIVISOR = Sql.AddParameter(cmd, "@MINUTE_DIVISOR", nMINUTE_DIVISOR  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCronRun
		/// <summary>
		/// spCronRun
		/// </summary>
		public static IDbCommand cmdCronRun(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCronRun";
			IDbDataParameter parCRON           = Sql.CreateParameter(cmd, "@CRON"          , "string", 100);
			IDbDataParameter parCURRENT_TIME   = Sql.CreateParameter(cmd, "@CURRENT_TIME"  , "DateTime",   8);
			IDbDataParameter parMINUTE_DIVISOR = Sql.CreateParameter(cmd, "@MINUTE_DIVISOR", "Int32",   4);
			return cmd;
		}
		#endregion

		#region spCURRENCIES_Delete
		/// <summary>
		/// spCURRENCIES_Delete
		/// </summary>
		public static void spCURRENCIES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCURRENCIES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCURRENCIES_Delete
		/// <summary>
		/// spCURRENCIES_Delete
		/// </summary>
		public static void spCURRENCIES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCURRENCIES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCURRENCIES_Delete
		/// <summary>
		/// spCURRENCIES_Delete
		/// </summary>
		public static IDbCommand cmdCURRENCIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCURRENCIES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCURRENCIES_InsertOnly
		/// <summary>
		/// spCURRENCIES_InsertOnly
		/// </summary>
		public static void spCURRENCIES_InsertOnly(Guid gID, string sNAME, string sSYMBOL, string sISO4217, float flCONVERSION_RATE, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCURRENCIES_InsertOnly";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  36);
							IDbDataParameter parSYMBOL           = Sql.AddParameter(cmd, "@SYMBOL"          , sSYMBOL            ,  36);
							IDbDataParameter parISO4217          = Sql.AddParameter(cmd, "@ISO4217"         , sISO4217           ,   3);
							IDbDataParameter parCONVERSION_RATE  = Sql.AddParameter(cmd, "@CONVERSION_RATE" , flCONVERSION_RATE  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCURRENCIES_InsertOnly
		/// <summary>
		/// spCURRENCIES_InsertOnly
		/// </summary>
		public static void spCURRENCIES_InsertOnly(Guid gID, string sNAME, string sSYMBOL, string sISO4217, float flCONVERSION_RATE, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCURRENCIES_InsertOnly";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  36);
				IDbDataParameter parSYMBOL           = Sql.AddParameter(cmd, "@SYMBOL"          , sSYMBOL            ,  36);
				IDbDataParameter parISO4217          = Sql.AddParameter(cmd, "@ISO4217"         , sISO4217           ,   3);
				IDbDataParameter parCONVERSION_RATE  = Sql.AddParameter(cmd, "@CONVERSION_RATE" , flCONVERSION_RATE  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCURRENCIES_InsertOnly
		/// <summary>
		/// spCURRENCIES_InsertOnly
		/// </summary>
		public static IDbCommand cmdCURRENCIES_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCURRENCIES_InsertOnly";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  36);
			IDbDataParameter parSYMBOL           = Sql.CreateParameter(cmd, "@SYMBOL"          , "string",  36);
			IDbDataParameter parISO4217          = Sql.CreateParameter(cmd, "@ISO4217"         , "string",   3);
			IDbDataParameter parCONVERSION_RATE  = Sql.CreateParameter(cmd, "@CONVERSION_RATE" , "float",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			return cmd;
		}
		#endregion

		#region spCURRENCIES_Update
		/// <summary>
		/// spCURRENCIES_Update
		/// </summary>
		public static void spCURRENCIES_Update(ref Guid gID, string sNAME, string sSYMBOL, string sISO4217, float flCONVERSION_RATE, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCURRENCIES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  36);
							IDbDataParameter parSYMBOL           = Sql.AddParameter(cmd, "@SYMBOL"          , sSYMBOL            ,  36);
							IDbDataParameter parISO4217          = Sql.AddParameter(cmd, "@ISO4217"         , sISO4217           ,   3);
							IDbDataParameter parCONVERSION_RATE  = Sql.AddParameter(cmd, "@CONVERSION_RATE" , flCONVERSION_RATE  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCURRENCIES_Update
		/// <summary>
		/// spCURRENCIES_Update
		/// </summary>
		public static void spCURRENCIES_Update(ref Guid gID, string sNAME, string sSYMBOL, string sISO4217, float flCONVERSION_RATE, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCURRENCIES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  36);
				IDbDataParameter parSYMBOL           = Sql.AddParameter(cmd, "@SYMBOL"          , sSYMBOL            ,  36);
				IDbDataParameter parISO4217          = Sql.AddParameter(cmd, "@ISO4217"         , sISO4217           ,   3);
				IDbDataParameter parCONVERSION_RATE  = Sql.AddParameter(cmd, "@CONVERSION_RATE" , flCONVERSION_RATE  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCURRENCIES_Update
		/// <summary>
		/// spCURRENCIES_Update
		/// </summary>
		public static IDbCommand cmdCURRENCIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCURRENCIES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  36);
			IDbDataParameter parSYMBOL           = Sql.CreateParameter(cmd, "@SYMBOL"          , "string",  36);
			IDbDataParameter parISO4217          = Sql.CreateParameter(cmd, "@ISO4217"         , "string",   3);
			IDbDataParameter parCONVERSION_RATE  = Sql.CreateParameter(cmd, "@CONVERSION_RATE" , "float",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spCUSTOM_FIELDS_Delete
		/// <summary>
		/// spCUSTOM_FIELDS_Delete
		/// </summary>
		public static void spCUSTOM_FIELDS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCUSTOM_FIELDS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCUSTOM_FIELDS_Delete
		/// <summary>
		/// spCUSTOM_FIELDS_Delete
		/// </summary>
		public static void spCUSTOM_FIELDS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCUSTOM_FIELDS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdCUSTOM_FIELDS_Delete
		/// <summary>
		/// spCUSTOM_FIELDS_Delete
		/// </summary>
		public static IDbCommand cmdCUSTOM_FIELDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCUSTOM_FIELDS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spCUSTOM_FIELDS_Update
		/// <summary>
		/// spCUSTOM_FIELDS_Update
		/// </summary>
		public static void spCUSTOM_FIELDS_Update(ref Guid gID, Int32 nSET_NUM, string sFIELD0, string sFIELD1, string sFIELD2, string sFIELD3, string sFIELD4, string sFIELD5, string sFIELD6, string sFIELD7, string sFIELD8, string sFIELD9)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spCUSTOM_FIELDS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parSET_NUM          = Sql.AddParameter(cmd, "@SET_NUM"         , nSET_NUM           );
							IDbDataParameter parFIELD0           = Sql.AddParameter(cmd, "@FIELD0"          , sFIELD0            , 255);
							IDbDataParameter parFIELD1           = Sql.AddParameter(cmd, "@FIELD1"          , sFIELD1            , 255);
							IDbDataParameter parFIELD2           = Sql.AddParameter(cmd, "@FIELD2"          , sFIELD2            , 255);
							IDbDataParameter parFIELD3           = Sql.AddParameter(cmd, "@FIELD3"          , sFIELD3            , 255);
							IDbDataParameter parFIELD4           = Sql.AddParameter(cmd, "@FIELD4"          , sFIELD4            , 255);
							IDbDataParameter parFIELD5           = Sql.AddParameter(cmd, "@FIELD5"          , sFIELD5            , 255);
							IDbDataParameter parFIELD6           = Sql.AddParameter(cmd, "@FIELD6"          , sFIELD6            , 255);
							IDbDataParameter parFIELD7           = Sql.AddParameter(cmd, "@FIELD7"          , sFIELD7            , 255);
							IDbDataParameter parFIELD8           = Sql.AddParameter(cmd, "@FIELD8"          , sFIELD8            , 255);
							IDbDataParameter parFIELD9           = Sql.AddParameter(cmd, "@FIELD9"          , sFIELD9            , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spCUSTOM_FIELDS_Update
		/// <summary>
		/// spCUSTOM_FIELDS_Update
		/// </summary>
		public static void spCUSTOM_FIELDS_Update(ref Guid gID, Int32 nSET_NUM, string sFIELD0, string sFIELD1, string sFIELD2, string sFIELD3, string sFIELD4, string sFIELD5, string sFIELD6, string sFIELD7, string sFIELD8, string sFIELD9, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spCUSTOM_FIELDS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parSET_NUM          = Sql.AddParameter(cmd, "@SET_NUM"         , nSET_NUM           );
				IDbDataParameter parFIELD0           = Sql.AddParameter(cmd, "@FIELD0"          , sFIELD0            , 255);
				IDbDataParameter parFIELD1           = Sql.AddParameter(cmd, "@FIELD1"          , sFIELD1            , 255);
				IDbDataParameter parFIELD2           = Sql.AddParameter(cmd, "@FIELD2"          , sFIELD2            , 255);
				IDbDataParameter parFIELD3           = Sql.AddParameter(cmd, "@FIELD3"          , sFIELD3            , 255);
				IDbDataParameter parFIELD4           = Sql.AddParameter(cmd, "@FIELD4"          , sFIELD4            , 255);
				IDbDataParameter parFIELD5           = Sql.AddParameter(cmd, "@FIELD5"          , sFIELD5            , 255);
				IDbDataParameter parFIELD6           = Sql.AddParameter(cmd, "@FIELD6"          , sFIELD6            , 255);
				IDbDataParameter parFIELD7           = Sql.AddParameter(cmd, "@FIELD7"          , sFIELD7            , 255);
				IDbDataParameter parFIELD8           = Sql.AddParameter(cmd, "@FIELD8"          , sFIELD8            , 255);
				IDbDataParameter parFIELD9           = Sql.AddParameter(cmd, "@FIELD9"          , sFIELD9            , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdCUSTOM_FIELDS_Update
		/// <summary>
		/// spCUSTOM_FIELDS_Update
		/// </summary>
		public static IDbCommand cmdCUSTOM_FIELDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spCUSTOM_FIELDS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parSET_NUM          = Sql.CreateParameter(cmd, "@SET_NUM"         , "Int32",   4);
			IDbDataParameter parFIELD0           = Sql.CreateParameter(cmd, "@FIELD0"          , "string", 255);
			IDbDataParameter parFIELD1           = Sql.CreateParameter(cmd, "@FIELD1"          , "string", 255);
			IDbDataParameter parFIELD2           = Sql.CreateParameter(cmd, "@FIELD2"          , "string", 255);
			IDbDataParameter parFIELD3           = Sql.CreateParameter(cmd, "@FIELD3"          , "string", 255);
			IDbDataParameter parFIELD4           = Sql.CreateParameter(cmd, "@FIELD4"          , "string", 255);
			IDbDataParameter parFIELD5           = Sql.CreateParameter(cmd, "@FIELD5"          , "string", 255);
			IDbDataParameter parFIELD6           = Sql.CreateParameter(cmd, "@FIELD6"          , "string", 255);
			IDbDataParameter parFIELD7           = Sql.CreateParameter(cmd, "@FIELD7"          , "string", 255);
			IDbDataParameter parFIELD8           = Sql.CreateParameter(cmd, "@FIELD8"          , "string", 255);
			IDbDataParameter parFIELD9           = Sql.CreateParameter(cmd, "@FIELD9"          , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDASHBOARDS_Delete
		/// <summary>
		/// spDASHBOARDS_Delete
		/// </summary>
		public static void spDASHBOARDS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDASHBOARDS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDASHBOARDS_Delete
		/// <summary>
		/// spDASHBOARDS_Delete
		/// </summary>
		public static void spDASHBOARDS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDASHBOARDS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDASHBOARDS_Delete
		/// <summary>
		/// spDASHBOARDS_Delete
		/// </summary>
		public static IDbCommand cmdDASHBOARDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDASHBOARDS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDASHBOARDS_Update
		/// <summary>
		/// spDASHBOARDS_Update
		/// </summary>
		public static void spDASHBOARDS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sCONTENT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDASHBOARDS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 100);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDASHBOARDS_Update
		/// <summary>
		/// spDASHBOARDS_Update
		/// </summary>
		public static void spDASHBOARDS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sCONTENT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDASHBOARDS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 100);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDASHBOARDS_Update
		/// <summary>
		/// spDASHBOARDS_Update
		/// </summary>
		public static IDbCommand cmdDASHBOARDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDASHBOARDS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 100);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parCONTENT          = Sql.CreateParameter(cmd, "@CONTENT"         , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_Delete
		/// <summary>
		/// spDETAILVIEWS_Delete
		/// </summary>
		public static void spDETAILVIEWS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_Delete
		/// <summary>
		/// spDETAILVIEWS_Delete
		/// </summary>
		public static void spDETAILVIEWS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_Delete
		/// <summary>
		/// spDETAILVIEWS_Delete
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_CnvBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_CnvBound
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_CnvBound(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_CnvBound";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_CnvBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_CnvBound
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_CnvBound(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_CnvBound";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_CnvBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_CnvBound
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_CnvBound(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_CnvBound";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_Delete
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Delete
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_Delete
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Delete
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_Delete
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Delete
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBlank
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBlank(string sDETAIL_NAME, Int32 nFIELD_INDEX, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBlank";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBlank
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBlank(string sDETAIL_NAME, Int32 nFIELD_INDEX, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBlank";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBlank
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsBlank(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBlank";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBound
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBound(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBound";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBound
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBound(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBound";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsBound
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBound
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsBound(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBound";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBoundList(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sLIST_NAME, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundL";
							else
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundList";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parLIST_NAME   = Sql.AddParameter(cmd, "@LIST_NAME"  , sLIST_NAME    ,  50);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsBoundList(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sLIST_NAME, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundL";
				else
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundList";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parLIST_NAME   = Sql.AddParameter(cmd, "@LIST_NAME"  , sLIST_NAME    ,  50);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsBoundList(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundL";
			else
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsBoundList";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parLIST_NAME   = Sql.CreateParameter(cmd, "@LIST_NAME"  , "string",  50);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsButton
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsButton
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsButton(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_InsButton";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsButton
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsButton
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsButton(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsButton";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsButton
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsButton
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsButton(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_InsButton";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsCheckBox
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsCheckBox
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsCheckBox(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckB";
							else
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckBox";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsCheckBox
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsCheckBox
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsCheckBox(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckB";
				else
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckBox";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsCheckBox
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsCheckBox
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsCheckBox(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckB";
			else
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsCheckBox";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsertOnly(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnl";
							else
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnly";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parFIELD_TYPE  = Sql.AddParameter(cmd, "@FIELD_TYPE" , sFIELD_TYPE   ,  25);
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parURL_FIELD   = Sql.AddParameter(cmd, "@URL_FIELD"  , sURL_FIELD    ,  50);
							IDbDataParameter parURL_FORMAT  = Sql.AddParameter(cmd, "@URL_FORMAT" , sURL_FORMAT   , 100);
							IDbDataParameter parURL_TARGET  = Sql.AddParameter(cmd, "@URL_TARGET" , sURL_TARGET   ,  20);
							IDbDataParameter parLIST_NAME   = Sql.AddParameter(cmd, "@LIST_NAME"  , sLIST_NAME    ,  50);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsertOnly(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnl";
				else
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnly";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parFIELD_TYPE  = Sql.AddParameter(cmd, "@FIELD_TYPE" , sFIELD_TYPE   ,  25);
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parURL_FIELD   = Sql.AddParameter(cmd, "@URL_FIELD"  , sURL_FIELD    ,  50);
				IDbDataParameter parURL_FORMAT  = Sql.AddParameter(cmd, "@URL_FORMAT" , sURL_FORMAT   , 100);
				IDbDataParameter parURL_TARGET  = Sql.AddParameter(cmd, "@URL_TARGET" , sURL_TARGET   ,  20);
				IDbDataParameter parLIST_NAME   = Sql.AddParameter(cmd, "@LIST_NAME"  , sLIST_NAME    ,  50);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsertOnly
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnl";
			else
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsertOnly";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parFIELD_TYPE  = Sql.CreateParameter(cmd, "@FIELD_TYPE" , "string",  25);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parURL_FIELD   = Sql.CreateParameter(cmd, "@URL_FIELD"  , "string",  50);
			IDbDataParameter parURL_FORMAT  = Sql.CreateParameter(cmd, "@URL_FORMAT" , "string", 100);
			IDbDataParameter parURL_TARGET  = Sql.CreateParameter(cmd, "@URL_TARGET" , "string",  20);
			IDbDataParameter parLIST_NAME   = Sql.CreateParameter(cmd, "@LIST_NAME"  , "string",  50);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsHyperLink
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsHyperLink
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsHyperLink(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperL";
							else
								cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperLink";
							IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
							IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
							IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
							IDbDataParameter parURL_FIELD   = Sql.AddParameter(cmd, "@URL_FIELD"  , sURL_FIELD    ,  50);
							IDbDataParameter parURL_FORMAT  = Sql.AddParameter(cmd, "@URL_FORMAT" , sURL_FORMAT   , 100);
							IDbDataParameter parURL_TARGET  = Sql.AddParameter(cmd, "@URL_TARGET" , sURL_TARGET   ,  20);
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_InsHyperLink
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsHyperLink
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_InsHyperLink(string sDETAIL_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperL";
				else
					cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperLink";
				IDbDataParameter parDETAIL_NAME = Sql.AddParameter(cmd, "@DETAIL_NAME", sDETAIL_NAME  ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parDATA_LABEL  = Sql.AddParameter(cmd, "@DATA_LABEL" , sDATA_LABEL   , 150);
				IDbDataParameter parDATA_FIELD  = Sql.AddParameter(cmd, "@DATA_FIELD" , sDATA_FIELD   , 100);
				IDbDataParameter parDATA_FORMAT = Sql.AddParameter(cmd, "@DATA_FORMAT", sDATA_FORMAT  , 100);
				IDbDataParameter parURL_FIELD   = Sql.AddParameter(cmd, "@URL_FIELD"  , sURL_FIELD    ,  50);
				IDbDataParameter parURL_FORMAT  = Sql.AddParameter(cmd, "@URL_FORMAT" , sURL_FORMAT   , 100);
				IDbDataParameter parURL_TARGET  = Sql.AddParameter(cmd, "@URL_TARGET" , sURL_TARGET   ,  20);
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_InsHyperLink
		/// <summary>
		/// spDETAILVIEWS_FIELDS_InsHyperLink
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_InsHyperLink(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperL";
			else
				cmd.CommandText = "spDETAILVIEWS_FIELDS_InsHyperLink";
			IDbDataParameter parDETAIL_NAME = Sql.CreateParameter(cmd, "@DETAIL_NAME", "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parDATA_LABEL  = Sql.CreateParameter(cmd, "@DATA_LABEL" , "string", 150);
			IDbDataParameter parDATA_FIELD  = Sql.CreateParameter(cmd, "@DATA_FIELD" , "string", 100);
			IDbDataParameter parDATA_FORMAT = Sql.CreateParameter(cmd, "@DATA_FORMAT", "string", 100);
			IDbDataParameter parURL_FIELD   = Sql.CreateParameter(cmd, "@URL_FIELD"  , "string",  50);
			IDbDataParameter parURL_FORMAT  = Sql.CreateParameter(cmd, "@URL_FORMAT" , "string", 100);
			IDbDataParameter parURL_TARGET  = Sql.CreateParameter(cmd, "@URL_TARGET" , "string",  20);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_Update
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Update
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_Update(ref Guid gID, string sDETAIL_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_FIELDS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parDETAIL_NAME      = Sql.AddParameter(cmd, "@DETAIL_NAME"     , sDETAIL_NAME       ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parFIELD_TYPE       = Sql.AddParameter(cmd, "@FIELD_TYPE"      , sFIELD_TYPE        ,  25);
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_FORMAT      = Sql.AddParameter(cmd, "@DATA_FORMAT"     , sDATA_FORMAT       , 100);
							IDbDataParameter parURL_FIELD        = Sql.AddParameter(cmd, "@URL_FIELD"       , sURL_FIELD         ,  50);
							IDbDataParameter parURL_FORMAT       = Sql.AddParameter(cmd, "@URL_FORMAT"      , sURL_FORMAT        , 100);
							IDbDataParameter parURL_TARGET       = Sql.AddParameter(cmd, "@URL_TARGET"      , sURL_TARGET        ,  20);
							IDbDataParameter parLIST_NAME        = Sql.AddParameter(cmd, "@LIST_NAME"       , sLIST_NAME         ,  50);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_FIELDS_Update
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Update
		/// </summary>
		public static void spDETAILVIEWS_FIELDS_Update(ref Guid gID, string sDETAIL_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_FIELDS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parDETAIL_NAME      = Sql.AddParameter(cmd, "@DETAIL_NAME"     , sDETAIL_NAME       ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parFIELD_TYPE       = Sql.AddParameter(cmd, "@FIELD_TYPE"      , sFIELD_TYPE        ,  25);
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_FORMAT      = Sql.AddParameter(cmd, "@DATA_FORMAT"     , sDATA_FORMAT       , 100);
				IDbDataParameter parURL_FIELD        = Sql.AddParameter(cmd, "@URL_FIELD"       , sURL_FIELD         ,  50);
				IDbDataParameter parURL_FORMAT       = Sql.AddParameter(cmd, "@URL_FORMAT"      , sURL_FORMAT        , 100);
				IDbDataParameter parURL_TARGET       = Sql.AddParameter(cmd, "@URL_TARGET"      , sURL_TARGET        ,  20);
				IDbDataParameter parLIST_NAME        = Sql.AddParameter(cmd, "@LIST_NAME"       , sLIST_NAME         ,  50);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDETAILVIEWS_FIELDS_Update
		/// <summary>
		/// spDETAILVIEWS_FIELDS_Update
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_FIELDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_FIELDS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parDETAIL_NAME      = Sql.CreateParameter(cmd, "@DETAIL_NAME"     , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parFIELD_TYPE       = Sql.CreateParameter(cmd, "@FIELD_TYPE"      , "string",  25);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_FORMAT      = Sql.CreateParameter(cmd, "@DATA_FORMAT"     , "string", 100);
			IDbDataParameter parURL_FIELD        = Sql.CreateParameter(cmd, "@URL_FIELD"       , "string",  50);
			IDbDataParameter parURL_FORMAT       = Sql.CreateParameter(cmd, "@URL_FORMAT"      , "string", 100);
			IDbDataParameter parURL_TARGET       = Sql.CreateParameter(cmd, "@URL_TARGET"      , "string",  20);
			IDbDataParameter parLIST_NAME        = Sql.CreateParameter(cmd, "@LIST_NAME"       , "string",  50);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_InsertOnly";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
							IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
							IDbDataParameter parVIEW_NAME    = Sql.AddParameter(cmd, "@VIEW_NAME"   , sVIEW_NAME     ,  50);
							IDbDataParameter parLABEL_WIDTH  = Sql.AddParameter(cmd, "@LABEL_WIDTH" , sLABEL_WIDTH   ,  10);
							IDbDataParameter parFIELD_WIDTH  = Sql.AddParameter(cmd, "@FIELD_WIDTH" , sFIELD_WIDTH   ,  10);
							IDbDataParameter parDATA_COLUMNS = Sql.AddParameter(cmd, "@DATA_COLUMNS", nDATA_COLUMNS  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_InsertOnly";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
				IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
				IDbDataParameter parVIEW_NAME    = Sql.AddParameter(cmd, "@VIEW_NAME"   , sVIEW_NAME     ,  50);
				IDbDataParameter parLABEL_WIDTH  = Sql.AddParameter(cmd, "@LABEL_WIDTH" , sLABEL_WIDTH   ,  10);
				IDbDataParameter parFIELD_WIDTH  = Sql.AddParameter(cmd, "@FIELD_WIDTH" , sFIELD_WIDTH   ,  10);
				IDbDataParameter parDATA_COLUMNS = Sql.AddParameter(cmd, "@DATA_COLUMNS", nDATA_COLUMNS  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_InsertOnly
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_InsertOnly";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  50);
			IDbDataParameter parMODULE_NAME  = Sql.CreateParameter(cmd, "@MODULE_NAME" , "string",  25);
			IDbDataParameter parVIEW_NAME    = Sql.CreateParameter(cmd, "@VIEW_NAME"   , "string",  50);
			IDbDataParameter parLABEL_WIDTH  = Sql.CreateParameter(cmd, "@LABEL_WIDTH" , "string",  10);
			IDbDataParameter parFIELD_WIDTH  = Sql.CreateParameter(cmd, "@FIELD_WIDTH" , "string",  10);
			IDbDataParameter parDATA_COLUMNS = Sql.CreateParameter(cmd, "@DATA_COLUMNS", "Int32",   4);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Delete
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Delete
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_De";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Delete
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Delete
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_De";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_Delete
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Delete
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_De";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Disable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Disable
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Disable(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Di";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Disable";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Disable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Disable
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Disable(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Di";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Disable";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_Disable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Disable
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_Disable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Di";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Disable";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Down
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Down
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Down(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Do";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Down";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Down
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Down
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Down(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Do";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Down";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_Down
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Down
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_Down(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Do";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Down";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Enable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Enable
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Enable(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_En";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Enable";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Enable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Enable
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Enable(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_En";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Enable";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_Enable
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Enable
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_Enable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_En";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Enable";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_InsertOnly(string sDETAIL_NAME, string sMODULE_NAME, string sCONTROL_NAME, Int32 nRELATIONSHIP_ORDER, string sTITLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_In";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_InsertOnly";
							IDbDataParameter parDETAIL_NAME        = Sql.AddParameter(cmd, "@DETAIL_NAME"       , sDETAIL_NAME         ,  50);
							IDbDataParameter parMODULE_NAME        = Sql.AddParameter(cmd, "@MODULE_NAME"       , sMODULE_NAME         ,  50);
							IDbDataParameter parCONTROL_NAME       = Sql.AddParameter(cmd, "@CONTROL_NAME"      , sCONTROL_NAME        ,  50);
							IDbDataParameter parRELATIONSHIP_ORDER = Sql.AddParameter(cmd, "@RELATIONSHIP_ORDER", nRELATIONSHIP_ORDER  );
							IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               , 100);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_InsertOnly(string sDETAIL_NAME, string sMODULE_NAME, string sCONTROL_NAME, Int32 nRELATIONSHIP_ORDER, string sTITLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_In";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_InsertOnly";
				IDbDataParameter parDETAIL_NAME        = Sql.AddParameter(cmd, "@DETAIL_NAME"       , sDETAIL_NAME         ,  50);
				IDbDataParameter parMODULE_NAME        = Sql.AddParameter(cmd, "@MODULE_NAME"       , sMODULE_NAME         ,  50);
				IDbDataParameter parCONTROL_NAME       = Sql.AddParameter(cmd, "@CONTROL_NAME"      , sCONTROL_NAME        ,  50);
				IDbDataParameter parRELATIONSHIP_ORDER = Sql.AddParameter(cmd, "@RELATIONSHIP_ORDER", nRELATIONSHIP_ORDER  );
				IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               , 100);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_InsertOnly
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_In";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_InsertOnly";
			IDbDataParameter parDETAIL_NAME        = Sql.CreateParameter(cmd, "@DETAIL_NAME"       , "string",  50);
			IDbDataParameter parMODULE_NAME        = Sql.CreateParameter(cmd, "@MODULE_NAME"       , "string",  50);
			IDbDataParameter parCONTROL_NAME       = Sql.CreateParameter(cmd, "@CONTROL_NAME"      , "string",  50);
			IDbDataParameter parRELATIONSHIP_ORDER = Sql.CreateParameter(cmd, "@RELATIONSHIP_ORDER", "Int32",   4);
			IDbDataParameter parTITLE              = Sql.CreateParameter(cmd, "@TITLE"             , "string", 100);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_MoveUp(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Mo";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_MoveUp";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_MoveUp(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Mo";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_MoveUp";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_MoveUp
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_MoveUp(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Mo";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_MoveUp";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Update
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Update
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Update(ref Guid gID, string sDETAIL_NAME, string sMODULE_NAME, string sCONTROL_NAME, Int32 nRELATIONSHIP_ORDER, string sTITLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Up";
							else
								cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parDETAIL_NAME        = Sql.AddParameter(cmd, "@DETAIL_NAME"       , sDETAIL_NAME         ,  50);
							IDbDataParameter parMODULE_NAME        = Sql.AddParameter(cmd, "@MODULE_NAME"       , sMODULE_NAME         ,  50);
							IDbDataParameter parCONTROL_NAME       = Sql.AddParameter(cmd, "@CONTROL_NAME"      , sCONTROL_NAME        ,  50);
							IDbDataParameter parRELATIONSHIP_ORDER = Sql.AddParameter(cmd, "@RELATIONSHIP_ORDER", nRELATIONSHIP_ORDER  );
							IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_RELATIONSHIPS_Update
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Update
		/// </summary>
		public static void spDETAILVIEWS_RELATIONSHIPS_Update(ref Guid gID, string sDETAIL_NAME, string sMODULE_NAME, string sCONTROL_NAME, Int32 nRELATIONSHIP_ORDER, string sTITLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Up";
				else
					cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parDETAIL_NAME        = Sql.AddParameter(cmd, "@DETAIL_NAME"       , sDETAIL_NAME         ,  50);
				IDbDataParameter parMODULE_NAME        = Sql.AddParameter(cmd, "@MODULE_NAME"       , sMODULE_NAME         ,  50);
				IDbDataParameter parCONTROL_NAME       = Sql.AddParameter(cmd, "@CONTROL_NAME"      , sCONTROL_NAME        ,  50);
				IDbDataParameter parRELATIONSHIP_ORDER = Sql.AddParameter(cmd, "@RELATIONSHIP_ORDER", nRELATIONSHIP_ORDER  );
				IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDETAILVIEWS_RELATIONSHIPS_Update
		/// <summary>
		/// spDETAILVIEWS_RELATIONSHIPS_Update
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_RELATIONSHIPS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Up";
			else
				cmd.CommandText = "spDETAILVIEWS_RELATIONSHIPS_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parDETAIL_NAME        = Sql.CreateParameter(cmd, "@DETAIL_NAME"       , "string",  50);
			IDbDataParameter parMODULE_NAME        = Sql.CreateParameter(cmd, "@MODULE_NAME"       , "string",  50);
			IDbDataParameter parCONTROL_NAME       = Sql.CreateParameter(cmd, "@CONTROL_NAME"      , "string",  50);
			IDbDataParameter parRELATIONSHIP_ORDER = Sql.CreateParameter(cmd, "@RELATIONSHIP_ORDER", "Int32",   4);
			IDbDataParameter parTITLE              = Sql.CreateParameter(cmd, "@TITLE"             , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDETAILVIEWS_Update
		/// <summary>
		/// spDETAILVIEWS_Update
		/// </summary>
		public static void spDETAILVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDETAILVIEWS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
							IDbDataParameter parLABEL_WIDTH      = Sql.AddParameter(cmd, "@LABEL_WIDTH"     , sLABEL_WIDTH       ,  10);
							IDbDataParameter parFIELD_WIDTH      = Sql.AddParameter(cmd, "@FIELD_WIDTH"     , sFIELD_WIDTH       ,  10);
							IDbDataParameter parDATA_COLUMNS     = Sql.AddParameter(cmd, "@DATA_COLUMNS"    , nDATA_COLUMNS      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDETAILVIEWS_Update
		/// <summary>
		/// spDETAILVIEWS_Update
		/// </summary>
		public static void spDETAILVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDETAILVIEWS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
				IDbDataParameter parLABEL_WIDTH      = Sql.AddParameter(cmd, "@LABEL_WIDTH"     , sLABEL_WIDTH       ,  10);
				IDbDataParameter parFIELD_WIDTH      = Sql.AddParameter(cmd, "@FIELD_WIDTH"     , sFIELD_WIDTH       ,  10);
				IDbDataParameter parDATA_COLUMNS     = Sql.AddParameter(cmd, "@DATA_COLUMNS"    , nDATA_COLUMNS      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDETAILVIEWS_Update
		/// <summary>
		/// spDETAILVIEWS_Update
		/// </summary>
		public static IDbCommand cmdDETAILVIEWS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDETAILVIEWS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parVIEW_NAME        = Sql.CreateParameter(cmd, "@VIEW_NAME"       , "string",  50);
			IDbDataParameter parLABEL_WIDTH      = Sql.CreateParameter(cmd, "@LABEL_WIDTH"     , "string",  10);
			IDbDataParameter parFIELD_WIDTH      = Sql.CreateParameter(cmd, "@FIELD_WIDTH"     , "string",  10);
			IDbDataParameter parDATA_COLUMNS     = Sql.CreateParameter(cmd, "@DATA_COLUMNS"    , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Delete
		/// <summary>
		/// spDOCUMENT_REVISIONS_Delete
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENT_REVISIONS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Delete
		/// <summary>
		/// spDOCUMENT_REVISIONS_Delete
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENT_REVISIONS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDOCUMENT_REVISIONS_Delete
		/// <summary>
		/// spDOCUMENT_REVISIONS_Delete
		/// </summary>
		public static IDbCommand cmdDOCUMENT_REVISIONS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENT_REVISIONS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Duplicate
		/// <summary>
		/// spDOCUMENT_REVISIONS_Duplicate
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Duplicate(ref Guid gID, Guid gDOCUMENT_ID, Guid gDUPLICATE_ID, string sREVISION, string sCHANGE_LOG)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENT_REVISIONS_Duplicate";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							IDbDataParameter parDUPLICATE_ID     = Sql.AddParameter(cmd, "@DUPLICATE_ID"    , gDUPLICATE_ID      );
							IDbDataParameter parREVISION         = Sql.AddParameter(cmd, "@REVISION"        , sREVISION          ,  25);
							IDbDataParameter parCHANGE_LOG       = Sql.AddParameter(cmd, "@CHANGE_LOG"      , sCHANGE_LOG        , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Duplicate
		/// <summary>
		/// spDOCUMENT_REVISIONS_Duplicate
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Duplicate(ref Guid gID, Guid gDOCUMENT_ID, Guid gDUPLICATE_ID, string sREVISION, string sCHANGE_LOG, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENT_REVISIONS_Duplicate";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				IDbDataParameter parDUPLICATE_ID     = Sql.AddParameter(cmd, "@DUPLICATE_ID"    , gDUPLICATE_ID      );
				IDbDataParameter parREVISION         = Sql.AddParameter(cmd, "@REVISION"        , sREVISION          ,  25);
				IDbDataParameter parCHANGE_LOG       = Sql.AddParameter(cmd, "@CHANGE_LOG"      , sCHANGE_LOG        , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDOCUMENT_REVISIONS_Duplicate
		/// <summary>
		/// spDOCUMENT_REVISIONS_Duplicate
		/// </summary>
		public static IDbCommand cmdDOCUMENT_REVISIONS_Duplicate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENT_REVISIONS_Duplicate";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			IDbDataParameter parDUPLICATE_ID     = Sql.CreateParameter(cmd, "@DUPLICATE_ID"    , "Guid",  16);
			IDbDataParameter parREVISION         = Sql.CreateParameter(cmd, "@REVISION"        , "string",  25);
			IDbDataParameter parCHANGE_LOG       = Sql.CreateParameter(cmd, "@CHANGE_LOG"      , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Insert
		/// <summary>
		/// spDOCUMENT_REVISIONS_Insert
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Insert(ref Guid gID, Guid gDOCUMENT_ID, string sREVISION, string sCHANGE_LOG, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENT_REVISIONS_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
							IDbDataParameter parREVISION         = Sql.AddParameter(cmd, "@REVISION"        , sREVISION          ,  25);
							IDbDataParameter parCHANGE_LOG       = Sql.AddParameter(cmd, "@CHANGE_LOG"      , sCHANGE_LOG        , 255);
							IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
							IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
							IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENT_REVISIONS_Insert
		/// <summary>
		/// spDOCUMENT_REVISIONS_Insert
		/// </summary>
		public static void spDOCUMENT_REVISIONS_Insert(ref Guid gID, Guid gDOCUMENT_ID, string sREVISION, string sCHANGE_LOG, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENT_REVISIONS_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parDOCUMENT_ID      = Sql.AddParameter(cmd, "@DOCUMENT_ID"     , gDOCUMENT_ID       );
				IDbDataParameter parREVISION         = Sql.AddParameter(cmd, "@REVISION"        , sREVISION          ,  25);
				IDbDataParameter parCHANGE_LOG       = Sql.AddParameter(cmd, "@CHANGE_LOG"      , sCHANGE_LOG        , 255);
				IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
				IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
				IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDOCUMENT_REVISIONS_Insert
		/// <summary>
		/// spDOCUMENT_REVISIONS_Insert
		/// </summary>
		public static IDbCommand cmdDOCUMENT_REVISIONS_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENT_REVISIONS_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parDOCUMENT_ID      = Sql.CreateParameter(cmd, "@DOCUMENT_ID"     , "Guid",  16);
			IDbDataParameter parREVISION         = Sql.CreateParameter(cmd, "@REVISION"        , "string",  25);
			IDbDataParameter parCHANGE_LOG       = Sql.CreateParameter(cmd, "@CHANGE_LOG"      , "string", 255);
			IDbDataParameter parFILENAME         = Sql.CreateParameter(cmd, "@FILENAME"        , "string", 255);
			IDbDataParameter parFILE_EXT         = Sql.CreateParameter(cmd, "@FILE_EXT"        , "string",  25);
			IDbDataParameter parFILE_MIME_TYPE   = Sql.CreateParameter(cmd, "@FILE_MIME_TYPE"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_CONTENT_InitPointer
		/// <summary>
		/// spDOCUMENTS_CONTENT_InitPointer
		/// </summary>
		public static void spDOCUMENTS_CONTENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointe";
							else
								cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointer";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							parFILE_POINTER.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_CONTENT_InitPointer
		/// <summary>
		/// spDOCUMENTS_CONTENT_InitPointer
		/// </summary>
		public static void spDOCUMENTS_CONTENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointe";
				else
					cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointer";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				parFILE_POINTER.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
			}
		}
		#endregion

		#region cmdDOCUMENTS_CONTENT_InitPointer
		/// <summary>
		/// spDOCUMENTS_CONTENT_InitPointer
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_CONTENT_InitPointer(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointe";
			else
				cmd.CommandText = "spDOCUMENTS_CONTENT_InitPointer";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			parFILE_POINTER.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_CONTENT_ReadOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_ReadOffset
		/// </summary>
		public static void spDOCUMENTS_CONTENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENTS_CONTENT_ReadOffset";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
							IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
							IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
							parBYTES.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							byBYTES = Sql.ToBinary(parBYTES.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_CONTENT_ReadOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_ReadOffset
		/// </summary>
		public static void spDOCUMENTS_CONTENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENTS_CONTENT_ReadOffset";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
				IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
				IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
				parBYTES.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				byBYTES = Sql.ToBinary(parBYTES.Value);
			}
		}
		#endregion

		#region cmdDOCUMENTS_CONTENT_ReadOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_ReadOffset
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_CONTENT_ReadOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENTS_CONTENT_ReadOffset";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parFILE_OFFSET = Sql.CreateParameter(cmd, "@FILE_OFFSET", "Int32",   4);
			IDbDataParameter parREAD_SIZE   = Sql.CreateParameter(cmd, "@READ_SIZE"  , "Int32",   4);
			IDbDataParameter parBYTES       = Sql.CreateParameter(cmd, "@BYTES"      , "byte[]",  16);
			parBYTES.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_CONTENT_WriteOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_WriteOffset
		/// </summary>
		public static void spDOCUMENTS_CONTENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffse";
							else
								cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffset";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
							IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_CONTENT_WriteOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_WriteOffset
		/// </summary>
		public static void spDOCUMENTS_CONTENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffse";
				else
					cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffset";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
				IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDOCUMENTS_CONTENT_WriteOffset
		/// <summary>
		/// spDOCUMENTS_CONTENT_WriteOffset
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_CONTENT_WriteOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffse";
			else
				cmd.CommandText = "spDOCUMENTS_CONTENT_WriteOffset";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_OFFSET      = Sql.CreateParameter(cmd, "@FILE_OFFSET"     , "Int32",   4);
			IDbDataParameter parBYTES            = Sql.CreateParameter(cmd, "@BYTES"           , "byte[]",  16);
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_Delete
		/// <summary>
		/// spDOCUMENTS_Delete
		/// </summary>
		public static void spDOCUMENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_Delete
		/// <summary>
		/// spDOCUMENTS_Delete
		/// </summary>
		public static void spDOCUMENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDOCUMENTS_Delete
		/// <summary>
		/// spDOCUMENTS_Delete
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_MassDelete
		/// <summary>
		/// spDOCUMENTS_MassDelete
		/// </summary>
		public static void spDOCUMENTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_MassDelete
		/// <summary>
		/// spDOCUMENTS_MassDelete
		/// </summary>
		public static void spDOCUMENTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDOCUMENTS_MassDelete
		/// <summary>
		/// spDOCUMENTS_MassDelete
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_MassUpdate
		/// <summary>
		/// spDOCUMENTS_MassUpdate
		/// </summary>
		public static void spDOCUMENTS_MassUpdate(string sID_LIST, DateTime dtACTIVE_DATE, DateTime dtEXP_DATE, string sCATEGORY_ID, string sSUBCATEGORY_ID, string sSTATUS_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACTIVE_DATE      = Sql.AddParameter(cmd, "@ACTIVE_DATE"     , dtACTIVE_DATE      );
							IDbDataParameter parEXP_DATE         = Sql.AddParameter(cmd, "@EXP_DATE"        , dtEXP_DATE         );
							IDbDataParameter parCATEGORY_ID      = Sql.AddParameter(cmd, "@CATEGORY_ID"     , sCATEGORY_ID       ,  25);
							IDbDataParameter parSUBCATEGORY_ID   = Sql.AddParameter(cmd, "@SUBCATEGORY_ID"  , sSUBCATEGORY_ID    ,  25);
							IDbDataParameter parSTATUS_ID        = Sql.AddParameter(cmd, "@STATUS_ID"       , sSTATUS_ID         ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_MassUpdate
		/// <summary>
		/// spDOCUMENTS_MassUpdate
		/// </summary>
		public static void spDOCUMENTS_MassUpdate(string sID_LIST, DateTime dtACTIVE_DATE, DateTime dtEXP_DATE, string sCATEGORY_ID, string sSUBCATEGORY_ID, string sSTATUS_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACTIVE_DATE      = Sql.AddParameter(cmd, "@ACTIVE_DATE"     , dtACTIVE_DATE      );
				IDbDataParameter parEXP_DATE         = Sql.AddParameter(cmd, "@EXP_DATE"        , dtEXP_DATE         );
				IDbDataParameter parCATEGORY_ID      = Sql.AddParameter(cmd, "@CATEGORY_ID"     , sCATEGORY_ID       ,  25);
				IDbDataParameter parSUBCATEGORY_ID   = Sql.AddParameter(cmd, "@SUBCATEGORY_ID"  , sSUBCATEGORY_ID    ,  25);
				IDbDataParameter parSTATUS_ID        = Sql.AddParameter(cmd, "@STATUS_ID"       , sSTATUS_ID         ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdDOCUMENTS_MassUpdate
		/// <summary>
		/// spDOCUMENTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACTIVE_DATE      = Sql.CreateParameter(cmd, "@ACTIVE_DATE"     , "DateTime",   8);
			IDbDataParameter parEXP_DATE         = Sql.CreateParameter(cmd, "@EXP_DATE"        , "DateTime",   8);
			IDbDataParameter parCATEGORY_ID      = Sql.CreateParameter(cmd, "@CATEGORY_ID"     , "string",  25);
			IDbDataParameter parSUBCATEGORY_ID   = Sql.CreateParameter(cmd, "@SUBCATEGORY_ID"  , "string",  25);
			IDbDataParameter parSTATUS_ID        = Sql.CreateParameter(cmd, "@STATUS_ID"       , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spDOCUMENTS_Update
		/// <summary>
		/// spDOCUMENTS_Update
		/// </summary>
		public static void spDOCUMENTS_Update(ref Guid gID, string sDOCUMENT_NAME, DateTime dtACTIVE_DATE, DateTime dtEXP_DATE, string sCATEGORY_ID, string sSUBCATEGORY_ID, string sSTATUS_ID, string sDESCRIPTION, bool bMAIL_MERGE_DOCUMENT, Guid gRELATED_DOC_ID, Guid gRELATED_DOC_REV_ID, bool bIS_TEMPLATE, string sTEMPLATE_TYPE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spDOCUMENTS_Update";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parDOCUMENT_NAME       = Sql.AddParameter(cmd, "@DOCUMENT_NAME"      , sDOCUMENT_NAME        , 255);
							IDbDataParameter parACTIVE_DATE         = Sql.AddParameter(cmd, "@ACTIVE_DATE"        , dtACTIVE_DATE         );
							IDbDataParameter parEXP_DATE            = Sql.AddParameter(cmd, "@EXP_DATE"           , dtEXP_DATE            );
							IDbDataParameter parCATEGORY_ID         = Sql.AddParameter(cmd, "@CATEGORY_ID"        , sCATEGORY_ID          ,  25);
							IDbDataParameter parSUBCATEGORY_ID      = Sql.AddParameter(cmd, "@SUBCATEGORY_ID"     , sSUBCATEGORY_ID       ,  25);
							IDbDataParameter parSTATUS_ID           = Sql.AddParameter(cmd, "@STATUS_ID"          , sSTATUS_ID            ,  25);
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
							IDbDataParameter parMAIL_MERGE_DOCUMENT = Sql.AddParameter(cmd, "@MAIL_MERGE_DOCUMENT", bMAIL_MERGE_DOCUMENT  );
							IDbDataParameter parRELATED_DOC_ID      = Sql.AddParameter(cmd, "@RELATED_DOC_ID"     , gRELATED_DOC_ID       );
							IDbDataParameter parRELATED_DOC_REV_ID  = Sql.AddParameter(cmd, "@RELATED_DOC_REV_ID" , gRELATED_DOC_REV_ID   );
							IDbDataParameter parIS_TEMPLATE         = Sql.AddParameter(cmd, "@IS_TEMPLATE"        , bIS_TEMPLATE          );
							IDbDataParameter parTEMPLATE_TYPE       = Sql.AddParameter(cmd, "@TEMPLATE_TYPE"      , sTEMPLATE_TYPE        ,  25);
							IDbDataParameter parTEAM_ID             = Sql.AddParameter(cmd, "@TEAM_ID"            , gTEAM_ID              );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spDOCUMENTS_Update
		/// <summary>
		/// spDOCUMENTS_Update
		/// </summary>
		public static void spDOCUMENTS_Update(ref Guid gID, string sDOCUMENT_NAME, DateTime dtACTIVE_DATE, DateTime dtEXP_DATE, string sCATEGORY_ID, string sSUBCATEGORY_ID, string sSTATUS_ID, string sDESCRIPTION, bool bMAIL_MERGE_DOCUMENT, Guid gRELATED_DOC_ID, Guid gRELATED_DOC_REV_ID, bool bIS_TEMPLATE, string sTEMPLATE_TYPE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spDOCUMENTS_Update";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parDOCUMENT_NAME       = Sql.AddParameter(cmd, "@DOCUMENT_NAME"      , sDOCUMENT_NAME        , 255);
				IDbDataParameter parACTIVE_DATE         = Sql.AddParameter(cmd, "@ACTIVE_DATE"        , dtACTIVE_DATE         );
				IDbDataParameter parEXP_DATE            = Sql.AddParameter(cmd, "@EXP_DATE"           , dtEXP_DATE            );
				IDbDataParameter parCATEGORY_ID         = Sql.AddParameter(cmd, "@CATEGORY_ID"        , sCATEGORY_ID          ,  25);
				IDbDataParameter parSUBCATEGORY_ID      = Sql.AddParameter(cmd, "@SUBCATEGORY_ID"     , sSUBCATEGORY_ID       ,  25);
				IDbDataParameter parSTATUS_ID           = Sql.AddParameter(cmd, "@STATUS_ID"          , sSTATUS_ID            ,  25);
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
				IDbDataParameter parMAIL_MERGE_DOCUMENT = Sql.AddParameter(cmd, "@MAIL_MERGE_DOCUMENT", bMAIL_MERGE_DOCUMENT  );
				IDbDataParameter parRELATED_DOC_ID      = Sql.AddParameter(cmd, "@RELATED_DOC_ID"     , gRELATED_DOC_ID       );
				IDbDataParameter parRELATED_DOC_REV_ID  = Sql.AddParameter(cmd, "@RELATED_DOC_REV_ID" , gRELATED_DOC_REV_ID   );
				IDbDataParameter parIS_TEMPLATE         = Sql.AddParameter(cmd, "@IS_TEMPLATE"        , bIS_TEMPLATE          );
				IDbDataParameter parTEMPLATE_TYPE       = Sql.AddParameter(cmd, "@TEMPLATE_TYPE"      , sTEMPLATE_TYPE        ,  25);
				IDbDataParameter parTEAM_ID             = Sql.AddParameter(cmd, "@TEAM_ID"            , gTEAM_ID              );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdDOCUMENTS_Update
		/// <summary>
		/// spDOCUMENTS_Update
		/// </summary>
		public static IDbCommand cmdDOCUMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spDOCUMENTS_Update";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parDOCUMENT_NAME       = Sql.CreateParameter(cmd, "@DOCUMENT_NAME"      , "string", 255);
			IDbDataParameter parACTIVE_DATE         = Sql.CreateParameter(cmd, "@ACTIVE_DATE"        , "DateTime",   8);
			IDbDataParameter parEXP_DATE            = Sql.CreateParameter(cmd, "@EXP_DATE"           , "DateTime",   8);
			IDbDataParameter parCATEGORY_ID         = Sql.CreateParameter(cmd, "@CATEGORY_ID"        , "string",  25);
			IDbDataParameter parSUBCATEGORY_ID      = Sql.CreateParameter(cmd, "@SUBCATEGORY_ID"     , "string",  25);
			IDbDataParameter parSTATUS_ID           = Sql.CreateParameter(cmd, "@STATUS_ID"          , "string",  25);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 104857600);
			IDbDataParameter parMAIL_MERGE_DOCUMENT = Sql.CreateParameter(cmd, "@MAIL_MERGE_DOCUMENT", "bool",   1);
			IDbDataParameter parRELATED_DOC_ID      = Sql.CreateParameter(cmd, "@RELATED_DOC_ID"     , "Guid",  16);
			IDbDataParameter parRELATED_DOC_REV_ID  = Sql.CreateParameter(cmd, "@RELATED_DOC_REV_ID" , "Guid",  16);
			IDbDataParameter parIS_TEMPLATE         = Sql.CreateParameter(cmd, "@IS_TEMPLATE"        , "bool",   1);
			IDbDataParameter parTEMPLATE_TYPE       = Sql.CreateParameter(cmd, "@TEMPLATE_TYPE"      , "string",  25);
			IDbDataParameter parTEAM_ID             = Sql.CreateParameter(cmd, "@TEAM_ID"            , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_Delete
		/// <summary>
		/// spEDITVIEWS_Delete
		/// </summary>
		public static void spEDITVIEWS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_Delete
		/// <summary>
		/// spEDITVIEWS_Delete
		/// </summary>
		public static void spEDITVIEWS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_Delete
		/// <summary>
		/// spEDITVIEWS_Delete
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_CnvChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_CnvChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_CnvChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_CnvChange";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
							IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_CnvChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_CnvChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_CnvChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_CnvChange";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
				IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_CnvChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_CnvChange
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_CnvChange(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_CnvChange";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parDISPLAY_FIELD    = Sql.CreateParameter(cmd, "@DISPLAY_FIELD"   , "string", 100);
			IDbDataParameter parONCLICK_SCRIPT   = Sql.CreateParameter(cmd, "@ONCLICK_SCRIPT"  , "string", 255);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_Delete
		/// <summary>
		/// spEDITVIEWS_FIELDS_Delete
		/// </summary>
		public static void spEDITVIEWS_FIELDS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_Delete
		/// <summary>
		/// spEDITVIEWS_FIELDS_Delete
		/// </summary>
		public static void spEDITVIEWS_FIELDS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_Delete
		/// <summary>
		/// spEDITVIEWS_FIELDS_Delete
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBlank
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBlank(string sEDIT_NAME, Int32 nFIELD_INDEX, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_InsBlank";
							IDbDataParameter parEDIT_NAME   = Sql.AddParameter(cmd, "@EDIT_NAME"  , sEDIT_NAME    ,  50);
							IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
							IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBlank
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBlank(string sEDIT_NAME, Int32 nFIELD_INDEX, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsBlank";
				IDbDataParameter parEDIT_NAME   = Sql.AddParameter(cmd, "@EDIT_NAME"  , sEDIT_NAME    ,  50);
				IDbDataParameter parFIELD_INDEX = Sql.AddParameter(cmd, "@FIELD_INDEX", nFIELD_INDEX  );
				IDbDataParameter parCOLSPAN     = Sql.AddParameter(cmd, "@COLSPAN"    , nCOLSPAN      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsBlank
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBlank
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsBlank(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_InsBlank";
			IDbDataParameter parEDIT_NAME   = Sql.CreateParameter(cmd, "@EDIT_NAME"  , "string",  50);
			IDbDataParameter parFIELD_INDEX = Sql.CreateParameter(cmd, "@FIELD_INDEX", "Int32",   4);
			IDbDataParameter parCOLSPAN     = Sql.CreateParameter(cmd, "@COLSPAN"    , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBound
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBound
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBound(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_InsBound";
							IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
							IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
							IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
							IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
							IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
							IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
							IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
							IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
							IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBound
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBound
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBound(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsBound";
				IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
				IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
				IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
				IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
				IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
				IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
				IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
				IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
				IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsBound
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBound
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsBound(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_InsBound";
			IDbDataParameter parEDIT_NAME         = Sql.CreateParameter(cmd, "@EDIT_NAME"        , "string",  50);
			IDbDataParameter parFIELD_INDEX       = Sql.CreateParameter(cmd, "@FIELD_INDEX"      , "Int32",   4);
			IDbDataParameter parDATA_LABEL        = Sql.CreateParameter(cmd, "@DATA_LABEL"       , "string", 150);
			IDbDataParameter parDATA_FIELD        = Sql.CreateParameter(cmd, "@DATA_FIELD"       , "string", 100);
			IDbDataParameter parDATA_REQUIRED     = Sql.CreateParameter(cmd, "@DATA_REQUIRED"    , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX  = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX" , "Int32",   4);
			IDbDataParameter parFORMAT_MAX_LENGTH = Sql.CreateParameter(cmd, "@FORMAT_MAX_LENGTH", "Int32",   4);
			IDbDataParameter parFORMAT_SIZE       = Sql.CreateParameter(cmd, "@FORMAT_SIZE"      , "Int32",   4);
			IDbDataParameter parCOLSPAN           = Sql.CreateParameter(cmd, "@COLSPAN"          , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBoundList(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sCACHE_NAME, Int32 nCOLSPAN, Int32 nFORMAT_ROWS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundLis";
							else
								cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundList";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parCACHE_NAME       = Sql.AddParameter(cmd, "@CACHE_NAME"      , sCACHE_NAME        ,  50);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							IDbDataParameter parFORMAT_ROWS      = Sql.AddParameter(cmd, "@FORMAT_ROWS"     , nFORMAT_ROWS       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsBoundList(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sCACHE_NAME, Int32 nCOLSPAN, Int32 nFORMAT_ROWS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundLis";
				else
					cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundList";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parCACHE_NAME       = Sql.AddParameter(cmd, "@CACHE_NAME"      , sCACHE_NAME        ,  50);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				IDbDataParameter parFORMAT_ROWS      = Sql.AddParameter(cmd, "@FORMAT_ROWS"     , nFORMAT_ROWS       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsBoundList
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsBoundList
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsBoundList(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundLis";
			else
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsBoundList";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parCACHE_NAME       = Sql.CreateParameter(cmd, "@CACHE_NAME"      , "string",  50);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			IDbDataParameter parFORMAT_ROWS      = Sql.CreateParameter(cmd, "@FORMAT_ROWS"     , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_InsChange";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
							IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsChange";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
				IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsChange
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsChange(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_InsChange";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parDISPLAY_FIELD    = Sql.CreateParameter(cmd, "@DISPLAY_FIELD"   , "string", 100);
			IDbDataParameter parONCLICK_SCRIPT   = Sql.CreateParameter(cmd, "@ONCLICK_SCRIPT"  , "string", 255);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsControl
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsControl
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsControl(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sFIELD_TYPE, string sONCLICK_SCRIPT, Int32 nCOLSPAN, Int32 nROWSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_InsControl";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parFIELD_TYPE       = Sql.AddParameter(cmd, "@FIELD_TYPE"      , sFIELD_TYPE        ,  50);
							IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							IDbDataParameter parROWSPAN          = Sql.AddParameter(cmd, "@ROWSPAN"         , nROWSPAN           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsControl
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsControl
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsControl(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sFIELD_TYPE, string sONCLICK_SCRIPT, Int32 nCOLSPAN, Int32 nROWSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsControl";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parFIELD_TYPE       = Sql.AddParameter(cmd, "@FIELD_TYPE"      , sFIELD_TYPE        ,  50);
				IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				IDbDataParameter parROWSPAN          = Sql.AddParameter(cmd, "@ROWSPAN"         , nROWSPAN           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsControl
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsControl
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsControl(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_InsControl";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parFIELD_TYPE       = Sql.CreateParameter(cmd, "@FIELD_TYPE"      , "string",  50);
			IDbDataParameter parONCLICK_SCRIPT   = Sql.CreateParameter(cmd, "@ONCLICK_SCRIPT"  , "string", 255);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			IDbDataParameter parROWSPAN          = Sql.CreateParameter(cmd, "@ROWSPAN"         , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsFile
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsFile
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsFile(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_InsFile";
							IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
							IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
							IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
							IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
							IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
							IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
							IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
							IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
							IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsFile
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsFile
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsFile(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsFile";
				IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
				IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
				IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
				IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
				IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
				IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
				IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
				IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
				IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsFile
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsFile
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsFile(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_InsFile";
			IDbDataParameter parEDIT_NAME         = Sql.CreateParameter(cmd, "@EDIT_NAME"        , "string",  50);
			IDbDataParameter parFIELD_INDEX       = Sql.CreateParameter(cmd, "@FIELD_INDEX"      , "Int32",   4);
			IDbDataParameter parDATA_LABEL        = Sql.CreateParameter(cmd, "@DATA_LABEL"       , "string", 150);
			IDbDataParameter parDATA_FIELD        = Sql.CreateParameter(cmd, "@DATA_FIELD"       , "string", 100);
			IDbDataParameter parDATA_REQUIRED     = Sql.CreateParameter(cmd, "@DATA_REQUIRED"    , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX  = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX" , "Int32",   4);
			IDbDataParameter parFORMAT_MAX_LENGTH = Sql.CreateParameter(cmd, "@FORMAT_MAX_LENGTH", "Int32",   4);
			IDbDataParameter parFORMAT_SIZE       = Sql.CreateParameter(cmd, "@FORMAT_SIZE"      , "Int32",   4);
			IDbDataParameter parCOLSPAN           = Sql.CreateParameter(cmd, "@COLSPAN"          , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsMultiLine
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsMultiLine
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsMultiLine(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_ROWS, Int32 nFORMAT_COLUMNS, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLin";
							else
								cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLine";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parFORMAT_ROWS      = Sql.AddParameter(cmd, "@FORMAT_ROWS"     , nFORMAT_ROWS       );
							IDbDataParameter parFORMAT_COLUMNS   = Sql.AddParameter(cmd, "@FORMAT_COLUMNS"  , nFORMAT_COLUMNS    );
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_InsMultiLine
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsMultiLine
		/// </summary>
		public static void spEDITVIEWS_FIELDS_InsMultiLine(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_ROWS, Int32 nFORMAT_COLUMNS, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLin";
				else
					cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLine";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parFORMAT_ROWS      = Sql.AddParameter(cmd, "@FORMAT_ROWS"     , nFORMAT_ROWS       );
				IDbDataParameter parFORMAT_COLUMNS   = Sql.AddParameter(cmd, "@FORMAT_COLUMNS"  , nFORMAT_COLUMNS    );
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_InsMultiLine
		/// <summary>
		/// spEDITVIEWS_FIELDS_InsMultiLine
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_InsMultiLine(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLin";
			else
				cmd.CommandText = "spEDITVIEWS_FIELDS_InsMultiLine";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parFORMAT_ROWS      = Sql.CreateParameter(cmd, "@FORMAT_ROWS"     , "Int32",   4);
			IDbDataParameter parFORMAT_COLUMNS   = Sql.CreateParameter(cmd, "@FORMAT_COLUMNS"  , "Int32",   4);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_LstChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_LstChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_LstChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_LstChange";
							IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
							IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
							IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
							IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
							IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
							IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
							IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
							IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
							IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_LstChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_LstChange
		/// </summary>
		public static void spEDITVIEWS_FIELDS_LstChange(string sEDIT_NAME, Int32 nFIELD_INDEX, string sDATA_LABEL, string sDATA_FIELD, bool bDATA_REQUIRED, Int32 nFORMAT_TAB_INDEX, string sDISPLAY_FIELD, string sONCLICK_SCRIPT, Int32 nCOLSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_LstChange";
				IDbDataParameter parEDIT_NAME        = Sql.AddParameter(cmd, "@EDIT_NAME"       , sEDIT_NAME         ,  50);
				IDbDataParameter parFIELD_INDEX      = Sql.AddParameter(cmd, "@FIELD_INDEX"     , nFIELD_INDEX       );
				IDbDataParameter parDATA_LABEL       = Sql.AddParameter(cmd, "@DATA_LABEL"      , sDATA_LABEL        , 150);
				IDbDataParameter parDATA_FIELD       = Sql.AddParameter(cmd, "@DATA_FIELD"      , sDATA_FIELD        , 100);
				IDbDataParameter parDATA_REQUIRED    = Sql.AddParameter(cmd, "@DATA_REQUIRED"   , bDATA_REQUIRED     );
				IDbDataParameter parFORMAT_TAB_INDEX = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX", nFORMAT_TAB_INDEX  );
				IDbDataParameter parDISPLAY_FIELD    = Sql.AddParameter(cmd, "@DISPLAY_FIELD"   , sDISPLAY_FIELD     , 100);
				IDbDataParameter parONCLICK_SCRIPT   = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"  , sONCLICK_SCRIPT    , 255);
				IDbDataParameter parCOLSPAN          = Sql.AddParameter(cmd, "@COLSPAN"         , nCOLSPAN           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_LstChange
		/// <summary>
		/// spEDITVIEWS_FIELDS_LstChange
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_LstChange(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_LstChange";
			IDbDataParameter parEDIT_NAME        = Sql.CreateParameter(cmd, "@EDIT_NAME"       , "string",  50);
			IDbDataParameter parFIELD_INDEX      = Sql.CreateParameter(cmd, "@FIELD_INDEX"     , "Int32",   4);
			IDbDataParameter parDATA_LABEL       = Sql.CreateParameter(cmd, "@DATA_LABEL"      , "string", 150);
			IDbDataParameter parDATA_FIELD       = Sql.CreateParameter(cmd, "@DATA_FIELD"      , "string", 100);
			IDbDataParameter parDATA_REQUIRED    = Sql.CreateParameter(cmd, "@DATA_REQUIRED"   , "bool",   1);
			IDbDataParameter parFORMAT_TAB_INDEX = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX", "Int32",   4);
			IDbDataParameter parDISPLAY_FIELD    = Sql.CreateParameter(cmd, "@DISPLAY_FIELD"   , "string", 100);
			IDbDataParameter parONCLICK_SCRIPT   = Sql.CreateParameter(cmd, "@ONCLICK_SCRIPT"  , "string", 255);
			IDbDataParameter parCOLSPAN          = Sql.CreateParameter(cmd, "@COLSPAN"         , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_FIELDS_Update
		/// <summary>
		/// spEDITVIEWS_FIELDS_Update
		/// </summary>
		public static void spEDITVIEWS_FIELDS_Update(ref Guid gID, string sEDIT_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDISPLAY_FIELD, string sCACHE_NAME, bool bDATA_REQUIRED, bool bUI_REQUIRED, string sONCLICK_SCRIPT, string sFORMAT_SCRIPT, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nFORMAT_ROWS, Int32 nFORMAT_COLUMNS, Int32 nCOLSPAN, Int32 nROWSPAN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_FIELDS_Update";
							IDbDataParameter parID                = Sql.AddParameter(cmd, "@ID"               , gID                 );
							IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
							IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
							IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
							IDbDataParameter parFIELD_TYPE        = Sql.AddParameter(cmd, "@FIELD_TYPE"       , sFIELD_TYPE         ,  25);
							IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
							IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
							IDbDataParameter parDISPLAY_FIELD     = Sql.AddParameter(cmd, "@DISPLAY_FIELD"    , sDISPLAY_FIELD      , 100);
							IDbDataParameter parCACHE_NAME        = Sql.AddParameter(cmd, "@CACHE_NAME"       , sCACHE_NAME         ,  50);
							IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
							IDbDataParameter parUI_REQUIRED       = Sql.AddParameter(cmd, "@UI_REQUIRED"      , bUI_REQUIRED        );
							IDbDataParameter parONCLICK_SCRIPT    = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"   , sONCLICK_SCRIPT     , 255);
							IDbDataParameter parFORMAT_SCRIPT     = Sql.AddParameter(cmd, "@FORMAT_SCRIPT"    , sFORMAT_SCRIPT      , 255);
							IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
							IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
							IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
							IDbDataParameter parFORMAT_ROWS       = Sql.AddParameter(cmd, "@FORMAT_ROWS"      , nFORMAT_ROWS        );
							IDbDataParameter parFORMAT_COLUMNS    = Sql.AddParameter(cmd, "@FORMAT_COLUMNS"   , nFORMAT_COLUMNS     );
							IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
							IDbDataParameter parROWSPAN           = Sql.AddParameter(cmd, "@ROWSPAN"          , nROWSPAN            );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_FIELDS_Update
		/// <summary>
		/// spEDITVIEWS_FIELDS_Update
		/// </summary>
		public static void spEDITVIEWS_FIELDS_Update(ref Guid gID, string sEDIT_NAME, Int32 nFIELD_INDEX, string sFIELD_TYPE, string sDATA_LABEL, string sDATA_FIELD, string sDISPLAY_FIELD, string sCACHE_NAME, bool bDATA_REQUIRED, bool bUI_REQUIRED, string sONCLICK_SCRIPT, string sFORMAT_SCRIPT, Int32 nFORMAT_TAB_INDEX, Int32 nFORMAT_MAX_LENGTH, Int32 nFORMAT_SIZE, Int32 nFORMAT_ROWS, Int32 nFORMAT_COLUMNS, Int32 nCOLSPAN, Int32 nROWSPAN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_FIELDS_Update";
				IDbDataParameter parID                = Sql.AddParameter(cmd, "@ID"               , gID                 );
				IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
				IDbDataParameter parEDIT_NAME         = Sql.AddParameter(cmd, "@EDIT_NAME"        , sEDIT_NAME          ,  50);
				IDbDataParameter parFIELD_INDEX       = Sql.AddParameter(cmd, "@FIELD_INDEX"      , nFIELD_INDEX        );
				IDbDataParameter parFIELD_TYPE        = Sql.AddParameter(cmd, "@FIELD_TYPE"       , sFIELD_TYPE         ,  25);
				IDbDataParameter parDATA_LABEL        = Sql.AddParameter(cmd, "@DATA_LABEL"       , sDATA_LABEL         , 150);
				IDbDataParameter parDATA_FIELD        = Sql.AddParameter(cmd, "@DATA_FIELD"       , sDATA_FIELD         , 100);
				IDbDataParameter parDISPLAY_FIELD     = Sql.AddParameter(cmd, "@DISPLAY_FIELD"    , sDISPLAY_FIELD      , 100);
				IDbDataParameter parCACHE_NAME        = Sql.AddParameter(cmd, "@CACHE_NAME"       , sCACHE_NAME         ,  50);
				IDbDataParameter parDATA_REQUIRED     = Sql.AddParameter(cmd, "@DATA_REQUIRED"    , bDATA_REQUIRED      );
				IDbDataParameter parUI_REQUIRED       = Sql.AddParameter(cmd, "@UI_REQUIRED"      , bUI_REQUIRED        );
				IDbDataParameter parONCLICK_SCRIPT    = Sql.AddParameter(cmd, "@ONCLICK_SCRIPT"   , sONCLICK_SCRIPT     , 255);
				IDbDataParameter parFORMAT_SCRIPT     = Sql.AddParameter(cmd, "@FORMAT_SCRIPT"    , sFORMAT_SCRIPT      , 255);
				IDbDataParameter parFORMAT_TAB_INDEX  = Sql.AddParameter(cmd, "@FORMAT_TAB_INDEX" , nFORMAT_TAB_INDEX   );
				IDbDataParameter parFORMAT_MAX_LENGTH = Sql.AddParameter(cmd, "@FORMAT_MAX_LENGTH", nFORMAT_MAX_LENGTH  );
				IDbDataParameter parFORMAT_SIZE       = Sql.AddParameter(cmd, "@FORMAT_SIZE"      , nFORMAT_SIZE        );
				IDbDataParameter parFORMAT_ROWS       = Sql.AddParameter(cmd, "@FORMAT_ROWS"      , nFORMAT_ROWS        );
				IDbDataParameter parFORMAT_COLUMNS    = Sql.AddParameter(cmd, "@FORMAT_COLUMNS"   , nFORMAT_COLUMNS     );
				IDbDataParameter parCOLSPAN           = Sql.AddParameter(cmd, "@COLSPAN"          , nCOLSPAN            );
				IDbDataParameter parROWSPAN           = Sql.AddParameter(cmd, "@ROWSPAN"          , nROWSPAN            );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEDITVIEWS_FIELDS_Update
		/// <summary>
		/// spEDITVIEWS_FIELDS_Update
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_FIELDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_FIELDS_Update";
			IDbDataParameter parID                = Sql.CreateParameter(cmd, "@ID"               , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID  = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID" , "Guid",  16);
			IDbDataParameter parEDIT_NAME         = Sql.CreateParameter(cmd, "@EDIT_NAME"        , "string",  50);
			IDbDataParameter parFIELD_INDEX       = Sql.CreateParameter(cmd, "@FIELD_INDEX"      , "Int32",   4);
			IDbDataParameter parFIELD_TYPE        = Sql.CreateParameter(cmd, "@FIELD_TYPE"       , "string",  25);
			IDbDataParameter parDATA_LABEL        = Sql.CreateParameter(cmd, "@DATA_LABEL"       , "string", 150);
			IDbDataParameter parDATA_FIELD        = Sql.CreateParameter(cmd, "@DATA_FIELD"       , "string", 100);
			IDbDataParameter parDISPLAY_FIELD     = Sql.CreateParameter(cmd, "@DISPLAY_FIELD"    , "string", 100);
			IDbDataParameter parCACHE_NAME        = Sql.CreateParameter(cmd, "@CACHE_NAME"       , "string",  50);
			IDbDataParameter parDATA_REQUIRED     = Sql.CreateParameter(cmd, "@DATA_REQUIRED"    , "bool",   1);
			IDbDataParameter parUI_REQUIRED       = Sql.CreateParameter(cmd, "@UI_REQUIRED"      , "bool",   1);
			IDbDataParameter parONCLICK_SCRIPT    = Sql.CreateParameter(cmd, "@ONCLICK_SCRIPT"   , "string", 255);
			IDbDataParameter parFORMAT_SCRIPT     = Sql.CreateParameter(cmd, "@FORMAT_SCRIPT"    , "string", 255);
			IDbDataParameter parFORMAT_TAB_INDEX  = Sql.CreateParameter(cmd, "@FORMAT_TAB_INDEX" , "Int32",   4);
			IDbDataParameter parFORMAT_MAX_LENGTH = Sql.CreateParameter(cmd, "@FORMAT_MAX_LENGTH", "Int32",   4);
			IDbDataParameter parFORMAT_SIZE       = Sql.CreateParameter(cmd, "@FORMAT_SIZE"      , "Int32",   4);
			IDbDataParameter parFORMAT_ROWS       = Sql.CreateParameter(cmd, "@FORMAT_ROWS"      , "Int32",   4);
			IDbDataParameter parFORMAT_COLUMNS    = Sql.CreateParameter(cmd, "@FORMAT_COLUMNS"   , "Int32",   4);
			IDbDataParameter parCOLSPAN           = Sql.CreateParameter(cmd, "@COLSPAN"          , "Int32",   4);
			IDbDataParameter parROWSPAN           = Sql.CreateParameter(cmd, "@ROWSPAN"          , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_InsertOnly
		/// <summary>
		/// spEDITVIEWS_InsertOnly
		/// </summary>
		public static void spEDITVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_InsertOnly";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
							IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
							IDbDataParameter parVIEW_NAME    = Sql.AddParameter(cmd, "@VIEW_NAME"   , sVIEW_NAME     ,  50);
							IDbDataParameter parLABEL_WIDTH  = Sql.AddParameter(cmd, "@LABEL_WIDTH" , sLABEL_WIDTH   ,  10);
							IDbDataParameter parFIELD_WIDTH  = Sql.AddParameter(cmd, "@FIELD_WIDTH" , sFIELD_WIDTH   ,  10);
							IDbDataParameter parDATA_COLUMNS = Sql.AddParameter(cmd, "@DATA_COLUMNS", nDATA_COLUMNS  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_InsertOnly
		/// <summary>
		/// spEDITVIEWS_InsertOnly
		/// </summary>
		public static void spEDITVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_InsertOnly";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
				IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
				IDbDataParameter parVIEW_NAME    = Sql.AddParameter(cmd, "@VIEW_NAME"   , sVIEW_NAME     ,  50);
				IDbDataParameter parLABEL_WIDTH  = Sql.AddParameter(cmd, "@LABEL_WIDTH" , sLABEL_WIDTH   ,  10);
				IDbDataParameter parFIELD_WIDTH  = Sql.AddParameter(cmd, "@FIELD_WIDTH" , sFIELD_WIDTH   ,  10);
				IDbDataParameter parDATA_COLUMNS = Sql.AddParameter(cmd, "@DATA_COLUMNS", nDATA_COLUMNS  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEDITVIEWS_InsertOnly
		/// <summary>
		/// spEDITVIEWS_InsertOnly
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_InsertOnly";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  50);
			IDbDataParameter parMODULE_NAME  = Sql.CreateParameter(cmd, "@MODULE_NAME" , "string",  25);
			IDbDataParameter parVIEW_NAME    = Sql.CreateParameter(cmd, "@VIEW_NAME"   , "string",  50);
			IDbDataParameter parLABEL_WIDTH  = Sql.CreateParameter(cmd, "@LABEL_WIDTH" , "string",  10);
			IDbDataParameter parFIELD_WIDTH  = Sql.CreateParameter(cmd, "@FIELD_WIDTH" , "string",  10);
			IDbDataParameter parDATA_COLUMNS = Sql.CreateParameter(cmd, "@DATA_COLUMNS", "Int32",   4);
			return cmd;
		}
		#endregion

		#region spEDITVIEWS_Update
		/// <summary>
		/// spEDITVIEWS_Update
		/// </summary>
		public static void spEDITVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEDITVIEWS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
							IDbDataParameter parLABEL_WIDTH      = Sql.AddParameter(cmd, "@LABEL_WIDTH"     , sLABEL_WIDTH       ,  10);
							IDbDataParameter parFIELD_WIDTH      = Sql.AddParameter(cmd, "@FIELD_WIDTH"     , sFIELD_WIDTH       ,  10);
							IDbDataParameter parDATA_COLUMNS     = Sql.AddParameter(cmd, "@DATA_COLUMNS"    , nDATA_COLUMNS      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEDITVIEWS_Update
		/// <summary>
		/// spEDITVIEWS_Update
		/// </summary>
		public static void spEDITVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME, string sLABEL_WIDTH, string sFIELD_WIDTH, Int32 nDATA_COLUMNS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEDITVIEWS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
				IDbDataParameter parLABEL_WIDTH      = Sql.AddParameter(cmd, "@LABEL_WIDTH"     , sLABEL_WIDTH       ,  10);
				IDbDataParameter parFIELD_WIDTH      = Sql.AddParameter(cmd, "@FIELD_WIDTH"     , sFIELD_WIDTH       ,  10);
				IDbDataParameter parDATA_COLUMNS     = Sql.AddParameter(cmd, "@DATA_COLUMNS"    , nDATA_COLUMNS      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEDITVIEWS_Update
		/// <summary>
		/// spEDITVIEWS_Update
		/// </summary>
		public static IDbCommand cmdEDITVIEWS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEDITVIEWS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parVIEW_NAME        = Sql.CreateParameter(cmd, "@VIEW_NAME"       , "string",  50);
			IDbDataParameter parLABEL_WIDTH      = Sql.CreateParameter(cmd, "@LABEL_WIDTH"     , "string",  10);
			IDbDataParameter parFIELD_WIDTH      = Sql.CreateParameter(cmd, "@FIELD_WIDTH"     , "string",  10);
			IDbDataParameter parDATA_COLUMNS     = Sql.CreateParameter(cmd, "@DATA_COLUMNS"    , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAIL_MARKETING_Delete
		/// <summary>
		/// spEMAIL_MARKETING_Delete
		/// </summary>
		public static void spEMAIL_MARKETING_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_MARKETING_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MARKETING_Delete
		/// <summary>
		/// spEMAIL_MARKETING_Delete
		/// </summary>
		public static void spEMAIL_MARKETING_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_MARKETING_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_MARKETING_Delete
		/// <summary>
		/// spEMAIL_MARKETING_Delete
		/// </summary>
		public static IDbCommand cmdEMAIL_MARKETING_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_MARKETING_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_MARKETING_Update
		/// <summary>
		/// spEMAIL_MARKETING_Update
		/// </summary>
		public static void spEMAIL_MARKETING_Update(ref Guid gID, string sNAME, string sFROM_ADDR, string sFROM_NAME, DateTime dtDATE_TIME, Guid gTEMPLATE_ID, Guid gCAMPAIGN_ID, Guid gINBOUND_EMAIL_ID, string sSTATUS, bool bALL_PROSPECT_LISTS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_MARKETING_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parNAME               = Sql.AddParameter(cmd, "@NAME"              , sNAME                , 255);
							IDbDataParameter parFROM_ADDR          = Sql.AddParameter(cmd, "@FROM_ADDR"         , sFROM_ADDR           , 100);
							IDbDataParameter parFROM_NAME          = Sql.AddParameter(cmd, "@FROM_NAME"         , sFROM_NAME           , 100);
							IDbDataParameter parDATE_TIME          = Sql.AddParameter(cmd, "@DATE_TIME"         , dtDATE_TIME          );
							IDbDataParameter parTEMPLATE_ID        = Sql.AddParameter(cmd, "@TEMPLATE_ID"       , gTEMPLATE_ID         );
							IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
							IDbDataParameter parINBOUND_EMAIL_ID   = Sql.AddParameter(cmd, "@INBOUND_EMAIL_ID"  , gINBOUND_EMAIL_ID    );
							IDbDataParameter parSTATUS             = Sql.AddParameter(cmd, "@STATUS"            , sSTATUS              ,  25);
							IDbDataParameter parALL_PROSPECT_LISTS = Sql.AddParameter(cmd, "@ALL_PROSPECT_LISTS", bALL_PROSPECT_LISTS  );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MARKETING_Update
		/// <summary>
		/// spEMAIL_MARKETING_Update
		/// </summary>
		public static void spEMAIL_MARKETING_Update(ref Guid gID, string sNAME, string sFROM_ADDR, string sFROM_NAME, DateTime dtDATE_TIME, Guid gTEMPLATE_ID, Guid gCAMPAIGN_ID, Guid gINBOUND_EMAIL_ID, string sSTATUS, bool bALL_PROSPECT_LISTS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_MARKETING_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parNAME               = Sql.AddParameter(cmd, "@NAME"              , sNAME                , 255);
				IDbDataParameter parFROM_ADDR          = Sql.AddParameter(cmd, "@FROM_ADDR"         , sFROM_ADDR           , 100);
				IDbDataParameter parFROM_NAME          = Sql.AddParameter(cmd, "@FROM_NAME"         , sFROM_NAME           , 100);
				IDbDataParameter parDATE_TIME          = Sql.AddParameter(cmd, "@DATE_TIME"         , dtDATE_TIME          );
				IDbDataParameter parTEMPLATE_ID        = Sql.AddParameter(cmd, "@TEMPLATE_ID"       , gTEMPLATE_ID         );
				IDbDataParameter parCAMPAIGN_ID        = Sql.AddParameter(cmd, "@CAMPAIGN_ID"       , gCAMPAIGN_ID         );
				IDbDataParameter parINBOUND_EMAIL_ID   = Sql.AddParameter(cmd, "@INBOUND_EMAIL_ID"  , gINBOUND_EMAIL_ID    );
				IDbDataParameter parSTATUS             = Sql.AddParameter(cmd, "@STATUS"            , sSTATUS              ,  25);
				IDbDataParameter parALL_PROSPECT_LISTS = Sql.AddParameter(cmd, "@ALL_PROSPECT_LISTS", bALL_PROSPECT_LISTS  );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAIL_MARKETING_Update
		/// <summary>
		/// spEMAIL_MARKETING_Update
		/// </summary>
		public static IDbCommand cmdEMAIL_MARKETING_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_MARKETING_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parNAME               = Sql.CreateParameter(cmd, "@NAME"              , "string", 255);
			IDbDataParameter parFROM_ADDR          = Sql.CreateParameter(cmd, "@FROM_ADDR"         , "string", 100);
			IDbDataParameter parFROM_NAME          = Sql.CreateParameter(cmd, "@FROM_NAME"         , "string", 100);
			IDbDataParameter parDATE_TIME          = Sql.CreateParameter(cmd, "@DATE_TIME"         , "DateTime",   8);
			IDbDataParameter parTEMPLATE_ID        = Sql.CreateParameter(cmd, "@TEMPLATE_ID"       , "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID        = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"       , "Guid",  16);
			IDbDataParameter parINBOUND_EMAIL_ID   = Sql.CreateParameter(cmd, "@INBOUND_EMAIL_ID"  , "Guid",  16);
			IDbDataParameter parSTATUS             = Sql.CreateParameter(cmd, "@STATUS"            , "string",  25);
			IDbDataParameter parALL_PROSPECT_LISTS = Sql.CreateParameter(cmd, "@ALL_PROSPECT_LISTS", "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAIL_MKTG_PRSPT_LST_Delete
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Delete
		/// </summary>
		public static void spEMAIL_MKTG_PRSPT_LST_Delete(Guid gEMAIL_MARKETING_ID, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Delete";
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
							IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MKTG_PRSPT_LST_Delete
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Delete
		/// </summary>
		public static void spEMAIL_MKTG_PRSPT_LST_Delete(Guid gEMAIL_MARKETING_ID, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Delete";
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
				IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_MKTG_PRSPT_LST_Delete
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Delete
		/// </summary>
		public static IDbCommand cmdEMAIL_MKTG_PRSPT_LST_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Delete";
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parEMAIL_MARKETING_ID = Sql.CreateParameter(cmd, "@EMAIL_MARKETING_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID   = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_MKTG_PRSPT_LST_Update
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Update
		/// </summary>
		public static void spEMAIL_MKTG_PRSPT_LST_Update(Guid gEMAIL_MARKETING_ID, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Update";
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
							IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MKTG_PRSPT_LST_Update
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Update
		/// </summary>
		public static void spEMAIL_MKTG_PRSPT_LST_Update(Guid gEMAIL_MARKETING_ID, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Update";
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
				IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_MKTG_PRSPT_LST_Update
		/// <summary>
		/// spEMAIL_MKTG_PRSPT_LST_Update
		/// </summary>
		public static IDbCommand cmdEMAIL_MKTG_PRSPT_LST_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_MKTG_PRSPT_LST_Update";
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parEMAIL_MARKETING_ID = Sql.CreateParameter(cmd, "@EMAIL_MARKETING_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID   = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// </summary>
		public static void spEMAIL_MRKT_PROSPECT_LISTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_De";
							else
								cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// </summary>
		public static void spEMAIL_MRKT_PROSPECT_LISTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_De";
				else
					cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Delete
		/// </summary>
		public static IDbCommand cmdEMAIL_MRKT_PROSPECT_LISTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_De";
			else
				cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_MRKT_PROSPECT_LISTS_Update
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Update
		/// </summary>
		public static void spEMAIL_MRKT_PROSPECT_LISTS_Update(ref Guid gID, Guid gPROSPECT_LIST_ID, Guid gEMAIL_MARKETING_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Up";
							else
								cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
							IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_MRKT_PROSPECT_LISTS_Update
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Update
		/// </summary>
		public static void spEMAIL_MRKT_PROSPECT_LISTS_Update(ref Guid gID, Guid gPROSPECT_LIST_ID, Guid gEMAIL_MARKETING_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Up";
				else
					cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parPROSPECT_LIST_ID   = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID"  , gPROSPECT_LIST_ID    );
				IDbDataParameter parEMAIL_MARKETING_ID = Sql.AddParameter(cmd, "@EMAIL_MARKETING_ID", gEMAIL_MARKETING_ID  );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAIL_MRKT_PROSPECT_LISTS_Update
		/// <summary>
		/// spEMAIL_MRKT_PROSPECT_LISTS_Update
		/// </summary>
		public static IDbCommand cmdEMAIL_MRKT_PROSPECT_LISTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Up";
			else
				cmd.CommandText = "spEMAIL_MRKT_PROSPECT_LISTS_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID   = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID"  , "Guid",  16);
			IDbDataParameter parEMAIL_MARKETING_ID = Sql.CreateParameter(cmd, "@EMAIL_MARKETING_ID", "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAIL_TEMPLATES_Delete
		/// <summary>
		/// spEMAIL_TEMPLATES_Delete
		/// </summary>
		public static void spEMAIL_TEMPLATES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_TEMPLATES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_TEMPLATES_Delete
		/// <summary>
		/// spEMAIL_TEMPLATES_Delete
		/// </summary>
		public static void spEMAIL_TEMPLATES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_TEMPLATES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_TEMPLATES_Delete
		/// <summary>
		/// spEMAIL_TEMPLATES_Delete
		/// </summary>
		public static IDbCommand cmdEMAIL_TEMPLATES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_TEMPLATES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_TEMPLATES_MassDelete
		/// <summary>
		/// spEMAIL_TEMPLATES_MassDelete
		/// </summary>
		public static void spEMAIL_TEMPLATES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_TEMPLATES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_TEMPLATES_MassDelete
		/// <summary>
		/// spEMAIL_TEMPLATES_MassDelete
		/// </summary>
		public static void spEMAIL_TEMPLATES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_TEMPLATES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAIL_TEMPLATES_MassDelete
		/// <summary>
		/// spEMAIL_TEMPLATES_MassDelete
		/// </summary>
		public static IDbCommand cmdEMAIL_TEMPLATES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_TEMPLATES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAIL_TEMPLATES_Update
		/// <summary>
		/// spEMAIL_TEMPLATES_Update
		/// </summary>
		public static void spEMAIL_TEMPLATES_Update(ref Guid gID, bool bPUBLISHED, bool bREAD_ONLY, string sNAME, string sDESCRIPTION, string sSUBJECT, string sBODY, string sBODY_HTML, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAIL_TEMPLATES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPUBLISHED        = Sql.AddParameter(cmd, "@PUBLISHED"       , bPUBLISHED         );
							IDbDataParameter parREAD_ONLY        = Sql.AddParameter(cmd, "@READ_ONLY"       , bREAD_ONLY         );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parSUBJECT          = Sql.AddParameter(cmd, "@SUBJECT"         , sSUBJECT           , 255);
							IDbDataParameter parBODY             = Sql.AddParameter(cmd, "@BODY"            , sBODY              );
							IDbDataParameter parBODY_HTML        = Sql.AddParameter(cmd, "@BODY_HTML"       , sBODY_HTML         );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAIL_TEMPLATES_Update
		/// <summary>
		/// spEMAIL_TEMPLATES_Update
		/// </summary>
		public static void spEMAIL_TEMPLATES_Update(ref Guid gID, bool bPUBLISHED, bool bREAD_ONLY, string sNAME, string sDESCRIPTION, string sSUBJECT, string sBODY, string sBODY_HTML, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAIL_TEMPLATES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPUBLISHED        = Sql.AddParameter(cmd, "@PUBLISHED"       , bPUBLISHED         );
				IDbDataParameter parREAD_ONLY        = Sql.AddParameter(cmd, "@READ_ONLY"       , bREAD_ONLY         );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parSUBJECT          = Sql.AddParameter(cmd, "@SUBJECT"         , sSUBJECT           , 255);
				IDbDataParameter parBODY             = Sql.AddParameter(cmd, "@BODY"            , sBODY              );
				IDbDataParameter parBODY_HTML        = Sql.AddParameter(cmd, "@BODY_HTML"       , sBODY_HTML         );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAIL_TEMPLATES_Update
		/// <summary>
		/// spEMAIL_TEMPLATES_Update
		/// </summary>
		public static IDbCommand cmdEMAIL_TEMPLATES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAIL_TEMPLATES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPUBLISHED        = Sql.CreateParameter(cmd, "@PUBLISHED"       , "bool",   1);
			IDbDataParameter parREAD_ONLY        = Sql.CreateParameter(cmd, "@READ_ONLY"       , "bool",   1);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parSUBJECT          = Sql.CreateParameter(cmd, "@SUBJECT"         , "string", 255);
			IDbDataParameter parBODY             = Sql.CreateParameter(cmd, "@BODY"            , "string", 104857600);
			IDbDataParameter parBODY_HTML        = Sql.CreateParameter(cmd, "@BODY_HTML"       , "string", 104857600);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILMAN_Delete
		/// <summary>
		/// spEMAILMAN_Delete
		/// </summary>
		public static void spEMAILMAN_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_Delete
		/// <summary>
		/// spEMAILMAN_Delete
		/// </summary>
		public static void spEMAILMAN_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILMAN_Delete
		/// <summary>
		/// spEMAILMAN_Delete
		/// </summary>
		public static IDbCommand cmdEMAILMAN_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILMAN_MassDelete
		/// <summary>
		/// spEMAILMAN_MassDelete
		/// </summary>
		public static void spEMAILMAN_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_MassDelete
		/// <summary>
		/// spEMAILMAN_MassDelete
		/// </summary>
		public static void spEMAILMAN_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILMAN_MassDelete
		/// <summary>
		/// spEMAILMAN_MassDelete
		/// </summary>
		public static IDbCommand cmdEMAILMAN_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILMAN_SendFailed
		/// <summary>
		/// spEMAILMAN_SendFailed
		/// </summary>
		public static void spEMAILMAN_SendFailed(Guid gID, string sACTIVITY_TYPE, bool bABORT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_SendFailed";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACTIVITY_TYPE    = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"   , sACTIVITY_TYPE     ,  25);
							IDbDataParameter parABORT            = Sql.AddParameter(cmd, "@ABORT"           , bABORT             );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_SendFailed
		/// <summary>
		/// spEMAILMAN_SendFailed
		/// </summary>
		public static void spEMAILMAN_SendFailed(Guid gID, string sACTIVITY_TYPE, bool bABORT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_SendFailed";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACTIVITY_TYPE    = Sql.AddParameter(cmd, "@ACTIVITY_TYPE"   , sACTIVITY_TYPE     ,  25);
				IDbDataParameter parABORT            = Sql.AddParameter(cmd, "@ABORT"           , bABORT             );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILMAN_SendFailed
		/// <summary>
		/// spEMAILMAN_SendFailed
		/// </summary>
		public static IDbCommand cmdEMAILMAN_SendFailed(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_SendFailed";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACTIVITY_TYPE    = Sql.CreateParameter(cmd, "@ACTIVITY_TYPE"   , "string",  25);
			IDbDataParameter parABORT            = Sql.CreateParameter(cmd, "@ABORT"           , "bool",   1);
			return cmd;
		}
		#endregion

		#region spEMAILMAN_SendSuccessful
		/// <summary>
		/// spEMAILMAN_SendSuccessful
		/// </summary>
		public static void spEMAILMAN_SendSuccessful(Guid gID, Guid gTARGET_TRACKER_KEY, Guid gEMAIL_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_SendSuccessful";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
							IDbDataParameter parEMAIL_ID           = Sql.AddParameter(cmd, "@EMAIL_ID"          , gEMAIL_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_SendSuccessful
		/// <summary>
		/// spEMAILMAN_SendSuccessful
		/// </summary>
		public static void spEMAILMAN_SendSuccessful(Guid gID, Guid gTARGET_TRACKER_KEY, Guid gEMAIL_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_SendSuccessful";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
				IDbDataParameter parEMAIL_ID           = Sql.AddParameter(cmd, "@EMAIL_ID"          , gEMAIL_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILMAN_SendSuccessful
		/// <summary>
		/// spEMAILMAN_SendSuccessful
		/// </summary>
		public static IDbCommand cmdEMAILMAN_SendSuccessful(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_SendSuccessful";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parTARGET_TRACKER_KEY = Sql.CreateParameter(cmd, "@TARGET_TRACKER_KEY", "Guid",  16);
			IDbDataParameter parEMAIL_ID           = Sql.CreateParameter(cmd, "@EMAIL_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILMAN_SENT_Delete
		/// <summary>
		/// spEMAILMAN_SENT_Delete
		/// </summary>
		public static void spEMAILMAN_SENT_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_SENT_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_SENT_Delete
		/// <summary>
		/// spEMAILMAN_SENT_Delete
		/// </summary>
		public static void spEMAILMAN_SENT_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_SENT_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILMAN_SENT_Delete
		/// <summary>
		/// spEMAILMAN_SENT_Delete
		/// </summary>
		public static IDbCommand cmdEMAILMAN_SENT_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_SENT_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILMAN_SENT_Update
		/// <summary>
		/// spEMAILMAN_SENT_Update
		/// </summary>
		public static void spEMAILMAN_SENT_Update(ref Guid gID, Guid gUSER_ID, Guid gTEMPLATE_ID, string sFROM_EMAIL, string sFROM_NAME, Guid gMODULE_ID, Guid gCAMPAIGN_ID, Guid gMARKETING_ID, Guid gLIST_ID, string sMODULE, DateTime dtSEND_DATE_TIME, bool bINVALID_EMAIL, bool bIN_QUEUE, DateTime dtIN_QUEUE_DATE, Int32 nSEND_ATTEMPTS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_SENT_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parTEMPLATE_ID      = Sql.AddParameter(cmd, "@TEMPLATE_ID"     , gTEMPLATE_ID       );
							IDbDataParameter parFROM_EMAIL       = Sql.AddParameter(cmd, "@FROM_EMAIL"      , sFROM_EMAIL        , 255);
							IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 255);
							IDbDataParameter parMODULE_ID        = Sql.AddParameter(cmd, "@MODULE_ID"       , gMODULE_ID         );
							IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
							IDbDataParameter parMARKETING_ID     = Sql.AddParameter(cmd, "@MARKETING_ID"    , gMARKETING_ID      );
							IDbDataParameter parLIST_ID          = Sql.AddParameter(cmd, "@LIST_ID"         , gLIST_ID           );
							IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            , 100);
							IDbDataParameter parSEND_DATE_TIME   = Sql.AddParameter(cmd, "@SEND_DATE_TIME"  , dtSEND_DATE_TIME   );
							IDbDataParameter parINVALID_EMAIL    = Sql.AddParameter(cmd, "@INVALID_EMAIL"   , bINVALID_EMAIL     );
							IDbDataParameter parIN_QUEUE         = Sql.AddParameter(cmd, "@IN_QUEUE"        , bIN_QUEUE          );
							IDbDataParameter parIN_QUEUE_DATE    = Sql.AddParameter(cmd, "@IN_QUEUE_DATE"   , dtIN_QUEUE_DATE    );
							IDbDataParameter parSEND_ATTEMPTS    = Sql.AddParameter(cmd, "@SEND_ATTEMPTS"   , nSEND_ATTEMPTS     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_SENT_Update
		/// <summary>
		/// spEMAILMAN_SENT_Update
		/// </summary>
		public static void spEMAILMAN_SENT_Update(ref Guid gID, Guid gUSER_ID, Guid gTEMPLATE_ID, string sFROM_EMAIL, string sFROM_NAME, Guid gMODULE_ID, Guid gCAMPAIGN_ID, Guid gMARKETING_ID, Guid gLIST_ID, string sMODULE, DateTime dtSEND_DATE_TIME, bool bINVALID_EMAIL, bool bIN_QUEUE, DateTime dtIN_QUEUE_DATE, Int32 nSEND_ATTEMPTS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_SENT_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parTEMPLATE_ID      = Sql.AddParameter(cmd, "@TEMPLATE_ID"     , gTEMPLATE_ID       );
				IDbDataParameter parFROM_EMAIL       = Sql.AddParameter(cmd, "@FROM_EMAIL"      , sFROM_EMAIL        , 255);
				IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 255);
				IDbDataParameter parMODULE_ID        = Sql.AddParameter(cmd, "@MODULE_ID"       , gMODULE_ID         );
				IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
				IDbDataParameter parMARKETING_ID     = Sql.AddParameter(cmd, "@MARKETING_ID"    , gMARKETING_ID      );
				IDbDataParameter parLIST_ID          = Sql.AddParameter(cmd, "@LIST_ID"         , gLIST_ID           );
				IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            , 100);
				IDbDataParameter parSEND_DATE_TIME   = Sql.AddParameter(cmd, "@SEND_DATE_TIME"  , dtSEND_DATE_TIME   );
				IDbDataParameter parINVALID_EMAIL    = Sql.AddParameter(cmd, "@INVALID_EMAIL"   , bINVALID_EMAIL     );
				IDbDataParameter parIN_QUEUE         = Sql.AddParameter(cmd, "@IN_QUEUE"        , bIN_QUEUE          );
				IDbDataParameter parIN_QUEUE_DATE    = Sql.AddParameter(cmd, "@IN_QUEUE_DATE"   , dtIN_QUEUE_DATE    );
				IDbDataParameter parSEND_ATTEMPTS    = Sql.AddParameter(cmd, "@SEND_ATTEMPTS"   , nSEND_ATTEMPTS     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAILMAN_SENT_Update
		/// <summary>
		/// spEMAILMAN_SENT_Update
		/// </summary>
		public static IDbCommand cmdEMAILMAN_SENT_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_SENT_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parTEMPLATE_ID      = Sql.CreateParameter(cmd, "@TEMPLATE_ID"     , "Guid",  16);
			IDbDataParameter parFROM_EMAIL       = Sql.CreateParameter(cmd, "@FROM_EMAIL"      , "string", 255);
			IDbDataParameter parFROM_NAME        = Sql.CreateParameter(cmd, "@FROM_NAME"       , "string", 255);
			IDbDataParameter parMODULE_ID        = Sql.CreateParameter(cmd, "@MODULE_ID"       , "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID      = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"     , "Guid",  16);
			IDbDataParameter parMARKETING_ID     = Sql.CreateParameter(cmd, "@MARKETING_ID"    , "Guid",  16);
			IDbDataParameter parLIST_ID          = Sql.CreateParameter(cmd, "@LIST_ID"         , "Guid",  16);
			IDbDataParameter parMODULE           = Sql.CreateParameter(cmd, "@MODULE"          , "string", 100);
			IDbDataParameter parSEND_DATE_TIME   = Sql.CreateParameter(cmd, "@SEND_DATE_TIME"  , "DateTime",   8);
			IDbDataParameter parINVALID_EMAIL    = Sql.CreateParameter(cmd, "@INVALID_EMAIL"   , "bool",   1);
			IDbDataParameter parIN_QUEUE         = Sql.CreateParameter(cmd, "@IN_QUEUE"        , "bool",   1);
			IDbDataParameter parIN_QUEUE_DATE    = Sql.CreateParameter(cmd, "@IN_QUEUE_DATE"   , "DateTime",   8);
			IDbDataParameter parSEND_ATTEMPTS    = Sql.CreateParameter(cmd, "@SEND_ATTEMPTS"   , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILMAN_Update
		/// <summary>
		/// spEMAILMAN_Update
		/// </summary>
		public static void spEMAILMAN_Update(ref Guid gID, Guid gUSER_ID, Guid gCAMPAIGN_ID, Guid gMARKETING_ID, Guid gLIST_ID, DateTime dtSEND_DATE_TIME, bool bIN_QUEUE, DateTime dtIN_QUEUE_DATE, Int32 nSEND_ATTEMPTS, Guid gRELATED_ID, string sRELATED_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILMAN_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
							IDbDataParameter parMARKETING_ID     = Sql.AddParameter(cmd, "@MARKETING_ID"    , gMARKETING_ID      );
							IDbDataParameter parLIST_ID          = Sql.AddParameter(cmd, "@LIST_ID"         , gLIST_ID           );
							IDbDataParameter parSEND_DATE_TIME   = Sql.AddParameter(cmd, "@SEND_DATE_TIME"  , dtSEND_DATE_TIME   );
							IDbDataParameter parIN_QUEUE         = Sql.AddParameter(cmd, "@IN_QUEUE"        , bIN_QUEUE          );
							IDbDataParameter parIN_QUEUE_DATE    = Sql.AddParameter(cmd, "@IN_QUEUE_DATE"   , dtIN_QUEUE_DATE    );
							IDbDataParameter parSEND_ATTEMPTS    = Sql.AddParameter(cmd, "@SEND_ATTEMPTS"   , nSEND_ATTEMPTS     );
							IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
							IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILMAN_Update
		/// <summary>
		/// spEMAILMAN_Update
		/// </summary>
		public static void spEMAILMAN_Update(ref Guid gID, Guid gUSER_ID, Guid gCAMPAIGN_ID, Guid gMARKETING_ID, Guid gLIST_ID, DateTime dtSEND_DATE_TIME, bool bIN_QUEUE, DateTime dtIN_QUEUE_DATE, Int32 nSEND_ATTEMPTS, Guid gRELATED_ID, string sRELATED_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILMAN_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
				IDbDataParameter parMARKETING_ID     = Sql.AddParameter(cmd, "@MARKETING_ID"    , gMARKETING_ID      );
				IDbDataParameter parLIST_ID          = Sql.AddParameter(cmd, "@LIST_ID"         , gLIST_ID           );
				IDbDataParameter parSEND_DATE_TIME   = Sql.AddParameter(cmd, "@SEND_DATE_TIME"  , dtSEND_DATE_TIME   );
				IDbDataParameter parIN_QUEUE         = Sql.AddParameter(cmd, "@IN_QUEUE"        , bIN_QUEUE          );
				IDbDataParameter parIN_QUEUE_DATE    = Sql.AddParameter(cmd, "@IN_QUEUE_DATE"   , dtIN_QUEUE_DATE    );
				IDbDataParameter parSEND_ATTEMPTS    = Sql.AddParameter(cmd, "@SEND_ATTEMPTS"   , nSEND_ATTEMPTS     );
				IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
				IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAILMAN_Update
		/// <summary>
		/// spEMAILMAN_Update
		/// </summary>
		public static IDbCommand cmdEMAILMAN_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILMAN_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID      = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"     , "Guid",  16);
			IDbDataParameter parMARKETING_ID     = Sql.CreateParameter(cmd, "@MARKETING_ID"    , "Guid",  16);
			IDbDataParameter parLIST_ID          = Sql.CreateParameter(cmd, "@LIST_ID"         , "Guid",  16);
			IDbDataParameter parSEND_DATE_TIME   = Sql.CreateParameter(cmd, "@SEND_DATE_TIME"  , "DateTime",   8);
			IDbDataParameter parIN_QUEUE         = Sql.CreateParameter(cmd, "@IN_QUEUE"        , "bool",   1);
			IDbDataParameter parIN_QUEUE_DATE    = Sql.CreateParameter(cmd, "@IN_QUEUE_DATE"   , "DateTime",   8);
			IDbDataParameter parSEND_ATTEMPTS    = Sql.CreateParameter(cmd, "@SEND_ATTEMPTS"   , "Int32",   4);
			IDbDataParameter parRELATED_ID       = Sql.CreateParameter(cmd, "@RELATED_ID"      , "Guid",  16);
			IDbDataParameter parRELATED_TYPE     = Sql.CreateParameter(cmd, "@RELATED_TYPE"    , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILS_ACCOUNTS_Delete
		/// <summary>
		/// spEMAILS_ACCOUNTS_Delete
		/// </summary>
		public static void spEMAILS_ACCOUNTS_Delete(Guid gEMAIL_ID, Guid gACCOUNT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_ACCOUNTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_ACCOUNTS_Delete
		/// <summary>
		/// spEMAILS_ACCOUNTS_Delete
		/// </summary>
		public static void spEMAILS_ACCOUNTS_Delete(Guid gEMAIL_ID, Guid gACCOUNT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_ACCOUNTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_ACCOUNTS_Delete
		/// <summary>
		/// spEMAILS_ACCOUNTS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_ACCOUNTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_ACCOUNTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_ACCOUNTS_Update
		/// <summary>
		/// spEMAILS_ACCOUNTS_Update
		/// </summary>
		public static void spEMAILS_ACCOUNTS_Update(Guid gEMAIL_ID, Guid gACCOUNT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_ACCOUNTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_ACCOUNTS_Update
		/// <summary>
		/// spEMAILS_ACCOUNTS_Update
		/// </summary>
		public static void spEMAILS_ACCOUNTS_Update(Guid gEMAIL_ID, Guid gACCOUNT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_ACCOUNTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_ACCOUNTS_Update
		/// <summary>
		/// spEMAILS_ACCOUNTS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_ACCOUNTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_ACCOUNTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_BUGS_Delete
		/// <summary>
		/// spEMAILS_BUGS_Delete
		/// </summary>
		public static void spEMAILS_BUGS_Delete(Guid gEMAIL_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_BUGS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_BUGS_Delete
		/// <summary>
		/// spEMAILS_BUGS_Delete
		/// </summary>
		public static void spEMAILS_BUGS_Delete(Guid gEMAIL_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_BUGS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_BUGS_Delete
		/// <summary>
		/// spEMAILS_BUGS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_BUGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_BUGS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_BUGS_Update
		/// <summary>
		/// spEMAILS_BUGS_Update
		/// </summary>
		public static void spEMAILS_BUGS_Update(Guid gEMAIL_ID, Guid gBUG_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_BUGS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_BUGS_Update
		/// <summary>
		/// spEMAILS_BUGS_Update
		/// </summary>
		public static void spEMAILS_BUGS_Update(Guid gEMAIL_ID, Guid gBUG_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_BUGS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parBUG_ID           = Sql.AddParameter(cmd, "@BUG_ID"          , gBUG_ID            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_BUGS_Update
		/// <summary>
		/// spEMAILS_BUGS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_BUGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_BUGS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parBUG_ID           = Sql.CreateParameter(cmd, "@BUG_ID"          , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_CampaignRef
		/// <summary>
		/// spEMAILS_CampaignRef
		/// </summary>
		public static void spEMAILS_CampaignRef(ref Guid gID, string sNAME, string sPARENT_TYPE, Guid gPARENT_ID, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sTO_ADDRS_IDS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sTYPE, string sSTATUS, string sRELATED_TYPE, Guid gRELATED_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_CampaignRef";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
							IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
							IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
							IDbDataParameter parTO_ADDRS         = Sql.AddParameter(cmd, "@TO_ADDRS"        , sTO_ADDRS          );
							IDbDataParameter parTO_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@TO_ADDRS_IDS"    , sTO_ADDRS_IDS      , 8000);
							IDbDataParameter parTO_ADDRS_NAMES   = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"  , sTO_ADDRS_NAMES    );
							IDbDataParameter parTO_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@TO_ADDRS_EMAILS" , sTO_ADDRS_EMAILS   );
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      ,  25);
							IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_CampaignRef
		/// <summary>
		/// spEMAILS_CampaignRef
		/// </summary>
		public static void spEMAILS_CampaignRef(ref Guid gID, string sNAME, string sPARENT_TYPE, Guid gPARENT_ID, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sTO_ADDRS_IDS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sTYPE, string sSTATUS, string sRELATED_TYPE, Guid gRELATED_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_CampaignRef";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
				IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
				IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
				IDbDataParameter parTO_ADDRS         = Sql.AddParameter(cmd, "@TO_ADDRS"        , sTO_ADDRS          );
				IDbDataParameter parTO_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@TO_ADDRS_IDS"    , sTO_ADDRS_IDS      , 8000);
				IDbDataParameter parTO_ADDRS_NAMES   = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"  , sTO_ADDRS_NAMES    );
				IDbDataParameter parTO_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@TO_ADDRS_EMAILS" , sTO_ADDRS_EMAILS   );
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parRELATED_TYPE     = Sql.AddParameter(cmd, "@RELATED_TYPE"    , sRELATED_TYPE      ,  25);
				IDbDataParameter parRELATED_ID       = Sql.AddParameter(cmd, "@RELATED_ID"      , gRELATED_ID        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAILS_CampaignRef
		/// <summary>
		/// spEMAILS_CampaignRef
		/// </summary>
		public static IDbCommand cmdEMAILS_CampaignRef(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_CampaignRef";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parDESCRIPTION_HTML = Sql.CreateParameter(cmd, "@DESCRIPTION_HTML", "string", 104857600);
			IDbDataParameter parFROM_ADDR        = Sql.CreateParameter(cmd, "@FROM_ADDR"       , "string", 100);
			IDbDataParameter parFROM_NAME        = Sql.CreateParameter(cmd, "@FROM_NAME"       , "string", 100);
			IDbDataParameter parTO_ADDRS         = Sql.CreateParameter(cmd, "@TO_ADDRS"        , "string", 104857600);
			IDbDataParameter parTO_ADDRS_IDS     = Sql.CreateParameter(cmd, "@TO_ADDRS_IDS"    , "ansistring", 8000);
			IDbDataParameter parTO_ADDRS_NAMES   = Sql.CreateParameter(cmd, "@TO_ADDRS_NAMES"  , "string", 104857600);
			IDbDataParameter parTO_ADDRS_EMAILS  = Sql.CreateParameter(cmd, "@TO_ADDRS_EMAILS" , "string", 104857600);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string",  25);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parRELATED_TYPE     = Sql.CreateParameter(cmd, "@RELATED_TYPE"    , "string",  25);
			IDbDataParameter parRELATED_ID       = Sql.CreateParameter(cmd, "@RELATED_ID"      , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILS_CASES_Delete
		/// <summary>
		/// spEMAILS_CASES_Delete
		/// </summary>
		public static void spEMAILS_CASES_Delete(Guid gEMAIL_ID, Guid gCASE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_CASES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_CASES_Delete
		/// <summary>
		/// spEMAILS_CASES_Delete
		/// </summary>
		public static void spEMAILS_CASES_Delete(Guid gEMAIL_ID, Guid gCASE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_CASES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_CASES_Delete
		/// <summary>
		/// spEMAILS_CASES_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_CASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_CASES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_CASES_Update
		/// <summary>
		/// spEMAILS_CASES_Update
		/// </summary>
		public static void spEMAILS_CASES_Update(Guid gEMAIL_ID, Guid gCASE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_CASES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_CASES_Update
		/// <summary>
		/// spEMAILS_CASES_Update
		/// </summary>
		public static void spEMAILS_CASES_Update(Guid gEMAIL_ID, Guid gCASE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_CASES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parCASE_ID          = Sql.AddParameter(cmd, "@CASE_ID"         , gCASE_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_CASES_Update
		/// <summary>
		/// spEMAILS_CASES_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_CASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_CASES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parCASE_ID          = Sql.CreateParameter(cmd, "@CASE_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_CONTACTS_Delete
		/// <summary>
		/// spEMAILS_CONTACTS_Delete
		/// </summary>
		public static void spEMAILS_CONTACTS_Delete(Guid gEMAIL_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_CONTACTS_Delete
		/// <summary>
		/// spEMAILS_CONTACTS_Delete
		/// </summary>
		public static void spEMAILS_CONTACTS_Delete(Guid gEMAIL_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_CONTACTS_Delete
		/// <summary>
		/// spEMAILS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_CONTACTS_Update
		/// <summary>
		/// spEMAILS_CONTACTS_Update
		/// </summary>
		public static void spEMAILS_CONTACTS_Update(Guid gEMAIL_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_CONTACTS_Update
		/// <summary>
		/// spEMAILS_CONTACTS_Update
		/// </summary>
		public static void spEMAILS_CONTACTS_Update(Guid gEMAIL_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_CONTACTS_Update
		/// <summary>
		/// spEMAILS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_Delete
		/// <summary>
		/// spEMAILS_Delete
		/// </summary>
		public static void spEMAILS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_Delete
		/// <summary>
		/// spEMAILS_Delete
		/// </summary>
		public static void spEMAILS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_Delete
		/// <summary>
		/// spEMAILS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_InsertInbound
		/// <summary>
		/// spEMAILS_InsertInbound
		/// </summary>
		public static void spEMAILS_InsertInbound(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, DateTime dtDATE_TIME, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sCC_ADDRS, string sBCC_ADDRS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sCC_ADDRS_NAMES, string sCC_ADDRS_EMAILS, string sBCC_ADDRS_NAMES, string sBCC_ADDRS_EMAILS, string sTYPE, string sSTATUS, string sMESSAGE_ID, string sREPLY_TO_NAME, string sREPLY_TO_ADDR, string sINTENT, Guid gMAILBOX_ID, Guid gTARGET_TRACKER_KEY, string sRAW_SOURCE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_InsertInbound";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
							IDbDataParameter parNAME               = Sql.AddParameter(cmd, "@NAME"              , sNAME                , 255);
							IDbDataParameter parDATE_TIME          = Sql.AddParameter(cmd, "@DATE_TIME"         , dtDATE_TIME          );
							IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
							IDbDataParameter parDESCRIPTION_HTML   = Sql.AddParameter(cmd, "@DESCRIPTION_HTML"  , sDESCRIPTION_HTML    );
							IDbDataParameter parFROM_ADDR          = Sql.AddParameter(cmd, "@FROM_ADDR"         , sFROM_ADDR           , 100);
							IDbDataParameter parFROM_NAME          = Sql.AddParameter(cmd, "@FROM_NAME"         , sFROM_NAME           , 100);
							IDbDataParameter parTO_ADDRS           = Sql.AddParameter(cmd, "@TO_ADDRS"          , sTO_ADDRS            );
							IDbDataParameter parCC_ADDRS           = Sql.AddParameter(cmd, "@CC_ADDRS"          , sCC_ADDRS            );
							IDbDataParameter parBCC_ADDRS          = Sql.AddParameter(cmd, "@BCC_ADDRS"         , sBCC_ADDRS           );
							IDbDataParameter parTO_ADDRS_NAMES     = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"    , sTO_ADDRS_NAMES      );
							IDbDataParameter parTO_ADDRS_EMAILS    = Sql.AddAnsiParam(cmd, "@TO_ADDRS_EMAILS"   , sTO_ADDRS_EMAILS     , 8000);
							IDbDataParameter parCC_ADDRS_NAMES     = Sql.AddParameter(cmd, "@CC_ADDRS_NAMES"    , sCC_ADDRS_NAMES      );
							IDbDataParameter parCC_ADDRS_EMAILS    = Sql.AddAnsiParam(cmd, "@CC_ADDRS_EMAILS"   , sCC_ADDRS_EMAILS     , 8000);
							IDbDataParameter parBCC_ADDRS_NAMES    = Sql.AddParameter(cmd, "@BCC_ADDRS_NAMES"   , sBCC_ADDRS_NAMES     );
							IDbDataParameter parBCC_ADDRS_EMAILS   = Sql.AddAnsiParam(cmd, "@BCC_ADDRS_EMAILS"  , sBCC_ADDRS_EMAILS    , 8000);
							IDbDataParameter parTYPE               = Sql.AddParameter(cmd, "@TYPE"              , sTYPE                ,  25);
							IDbDataParameter parSTATUS             = Sql.AddParameter(cmd, "@STATUS"            , sSTATUS              ,  25);
							IDbDataParameter parMESSAGE_ID         = Sql.AddParameter(cmd, "@MESSAGE_ID"        , sMESSAGE_ID          , 100);
							IDbDataParameter parREPLY_TO_NAME      = Sql.AddParameter(cmd, "@REPLY_TO_NAME"     , sREPLY_TO_NAME       , 100);
							IDbDataParameter parREPLY_TO_ADDR      = Sql.AddParameter(cmd, "@REPLY_TO_ADDR"     , sREPLY_TO_ADDR       , 100);
							IDbDataParameter parINTENT             = Sql.AddParameter(cmd, "@INTENT"            , sINTENT              ,  25);
							IDbDataParameter parMAILBOX_ID         = Sql.AddParameter(cmd, "@MAILBOX_ID"        , gMAILBOX_ID          );
							IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
							IDbDataParameter parRAW_SOURCE         = Sql.AddParameter(cmd, "@RAW_SOURCE"        , sRAW_SOURCE          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_InsertInbound
		/// <summary>
		/// spEMAILS_InsertInbound
		/// </summary>
		public static void spEMAILS_InsertInbound(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, DateTime dtDATE_TIME, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sCC_ADDRS, string sBCC_ADDRS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sCC_ADDRS_NAMES, string sCC_ADDRS_EMAILS, string sBCC_ADDRS_NAMES, string sBCC_ADDRS_EMAILS, string sTYPE, string sSTATUS, string sMESSAGE_ID, string sREPLY_TO_NAME, string sREPLY_TO_ADDR, string sINTENT, Guid gMAILBOX_ID, Guid gTARGET_TRACKER_KEY, string sRAW_SOURCE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_InsertInbound";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
				IDbDataParameter parNAME               = Sql.AddParameter(cmd, "@NAME"              , sNAME                , 255);
				IDbDataParameter parDATE_TIME          = Sql.AddParameter(cmd, "@DATE_TIME"         , dtDATE_TIME          );
				IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
				IDbDataParameter parDESCRIPTION_HTML   = Sql.AddParameter(cmd, "@DESCRIPTION_HTML"  , sDESCRIPTION_HTML    );
				IDbDataParameter parFROM_ADDR          = Sql.AddParameter(cmd, "@FROM_ADDR"         , sFROM_ADDR           , 100);
				IDbDataParameter parFROM_NAME          = Sql.AddParameter(cmd, "@FROM_NAME"         , sFROM_NAME           , 100);
				IDbDataParameter parTO_ADDRS           = Sql.AddParameter(cmd, "@TO_ADDRS"          , sTO_ADDRS            );
				IDbDataParameter parCC_ADDRS           = Sql.AddParameter(cmd, "@CC_ADDRS"          , sCC_ADDRS            );
				IDbDataParameter parBCC_ADDRS          = Sql.AddParameter(cmd, "@BCC_ADDRS"         , sBCC_ADDRS           );
				IDbDataParameter parTO_ADDRS_NAMES     = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"    , sTO_ADDRS_NAMES      );
				IDbDataParameter parTO_ADDRS_EMAILS    = Sql.AddAnsiParam(cmd, "@TO_ADDRS_EMAILS"   , sTO_ADDRS_EMAILS     , 8000);
				IDbDataParameter parCC_ADDRS_NAMES     = Sql.AddParameter(cmd, "@CC_ADDRS_NAMES"    , sCC_ADDRS_NAMES      );
				IDbDataParameter parCC_ADDRS_EMAILS    = Sql.AddAnsiParam(cmd, "@CC_ADDRS_EMAILS"   , sCC_ADDRS_EMAILS     , 8000);
				IDbDataParameter parBCC_ADDRS_NAMES    = Sql.AddParameter(cmd, "@BCC_ADDRS_NAMES"   , sBCC_ADDRS_NAMES     );
				IDbDataParameter parBCC_ADDRS_EMAILS   = Sql.AddAnsiParam(cmd, "@BCC_ADDRS_EMAILS"  , sBCC_ADDRS_EMAILS    , 8000);
				IDbDataParameter parTYPE               = Sql.AddParameter(cmd, "@TYPE"              , sTYPE                ,  25);
				IDbDataParameter parSTATUS             = Sql.AddParameter(cmd, "@STATUS"            , sSTATUS              ,  25);
				IDbDataParameter parMESSAGE_ID         = Sql.AddParameter(cmd, "@MESSAGE_ID"        , sMESSAGE_ID          , 100);
				IDbDataParameter parREPLY_TO_NAME      = Sql.AddParameter(cmd, "@REPLY_TO_NAME"     , sREPLY_TO_NAME       , 100);
				IDbDataParameter parREPLY_TO_ADDR      = Sql.AddParameter(cmd, "@REPLY_TO_ADDR"     , sREPLY_TO_ADDR       , 100);
				IDbDataParameter parINTENT             = Sql.AddParameter(cmd, "@INTENT"            , sINTENT              ,  25);
				IDbDataParameter parMAILBOX_ID         = Sql.AddParameter(cmd, "@MAILBOX_ID"        , gMAILBOX_ID          );
				IDbDataParameter parTARGET_TRACKER_KEY = Sql.AddParameter(cmd, "@TARGET_TRACKER_KEY", gTARGET_TRACKER_KEY  );
				IDbDataParameter parRAW_SOURCE         = Sql.AddParameter(cmd, "@RAW_SOURCE"        , sRAW_SOURCE          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAILS_InsertInbound
		/// <summary>
		/// spEMAILS_InsertInbound
		/// </summary>
		public static IDbCommand cmdEMAILS_InsertInbound(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_InsertInbound";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID   = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"  , "Guid",  16);
			IDbDataParameter parNAME               = Sql.CreateParameter(cmd, "@NAME"              , "string", 255);
			IDbDataParameter parDATE_TIME          = Sql.CreateParameter(cmd, "@DATE_TIME"         , "DateTime",   8);
			IDbDataParameter parDESCRIPTION        = Sql.CreateParameter(cmd, "@DESCRIPTION"       , "string", 104857600);
			IDbDataParameter parDESCRIPTION_HTML   = Sql.CreateParameter(cmd, "@DESCRIPTION_HTML"  , "string", 104857600);
			IDbDataParameter parFROM_ADDR          = Sql.CreateParameter(cmd, "@FROM_ADDR"         , "string", 100);
			IDbDataParameter parFROM_NAME          = Sql.CreateParameter(cmd, "@FROM_NAME"         , "string", 100);
			IDbDataParameter parTO_ADDRS           = Sql.CreateParameter(cmd, "@TO_ADDRS"          , "string", 104857600);
			IDbDataParameter parCC_ADDRS           = Sql.CreateParameter(cmd, "@CC_ADDRS"          , "string", 104857600);
			IDbDataParameter parBCC_ADDRS          = Sql.CreateParameter(cmd, "@BCC_ADDRS"         , "string", 104857600);
			IDbDataParameter parTO_ADDRS_NAMES     = Sql.CreateParameter(cmd, "@TO_ADDRS_NAMES"    , "string", 104857600);
			IDbDataParameter parTO_ADDRS_EMAILS    = Sql.CreateParameter(cmd, "@TO_ADDRS_EMAILS"   , "ansistring", 8000);
			IDbDataParameter parCC_ADDRS_NAMES     = Sql.CreateParameter(cmd, "@CC_ADDRS_NAMES"    , "string", 104857600);
			IDbDataParameter parCC_ADDRS_EMAILS    = Sql.CreateParameter(cmd, "@CC_ADDRS_EMAILS"   , "ansistring", 8000);
			IDbDataParameter parBCC_ADDRS_NAMES    = Sql.CreateParameter(cmd, "@BCC_ADDRS_NAMES"   , "string", 104857600);
			IDbDataParameter parBCC_ADDRS_EMAILS   = Sql.CreateParameter(cmd, "@BCC_ADDRS_EMAILS"  , "ansistring", 8000);
			IDbDataParameter parTYPE               = Sql.CreateParameter(cmd, "@TYPE"              , "string",  25);
			IDbDataParameter parSTATUS             = Sql.CreateParameter(cmd, "@STATUS"            , "string",  25);
			IDbDataParameter parMESSAGE_ID         = Sql.CreateParameter(cmd, "@MESSAGE_ID"        , "string", 100);
			IDbDataParameter parREPLY_TO_NAME      = Sql.CreateParameter(cmd, "@REPLY_TO_NAME"     , "string", 100);
			IDbDataParameter parREPLY_TO_ADDR      = Sql.CreateParameter(cmd, "@REPLY_TO_ADDR"     , "string", 100);
			IDbDataParameter parINTENT             = Sql.CreateParameter(cmd, "@INTENT"            , "string",  25);
			IDbDataParameter parMAILBOX_ID         = Sql.CreateParameter(cmd, "@MAILBOX_ID"        , "Guid",  16);
			IDbDataParameter parTARGET_TRACKER_KEY = Sql.CreateParameter(cmd, "@TARGET_TRACKER_KEY", "Guid",  16);
			IDbDataParameter parRAW_SOURCE         = Sql.CreateParameter(cmd, "@RAW_SOURCE"        , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILS_LEADS_Delete
		/// <summary>
		/// spEMAILS_LEADS_Delete
		/// </summary>
		public static void spEMAILS_LEADS_Delete(Guid gEMAIL_ID, Guid gLEAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_LEADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_LEADS_Delete
		/// <summary>
		/// spEMAILS_LEADS_Delete
		/// </summary>
		public static void spEMAILS_LEADS_Delete(Guid gEMAIL_ID, Guid gLEAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_LEADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_LEADS_Delete
		/// <summary>
		/// spEMAILS_LEADS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_LEADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_LEADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_LEADS_Update
		/// <summary>
		/// spEMAILS_LEADS_Update
		/// </summary>
		public static void spEMAILS_LEADS_Update(Guid gEMAIL_ID, Guid gLEAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_LEADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_LEADS_Update
		/// <summary>
		/// spEMAILS_LEADS_Update
		/// </summary>
		public static void spEMAILS_LEADS_Update(Guid gEMAIL_ID, Guid gLEAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_LEADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_LEADS_Update
		/// <summary>
		/// spEMAILS_LEADS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_LEADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_LEADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_MassDelete
		/// <summary>
		/// spEMAILS_MassDelete
		/// </summary>
		public static void spEMAILS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_MassDelete
		/// <summary>
		/// spEMAILS_MassDelete
		/// </summary>
		public static void spEMAILS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_MassDelete
		/// <summary>
		/// spEMAILS_MassDelete
		/// </summary>
		public static IDbCommand cmdEMAILS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_MassUpdate
		/// <summary>
		/// spEMAILS_MassUpdate
		/// </summary>
		public static void spEMAILS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_MassUpdate
		/// <summary>
		/// spEMAILS_MassUpdate
		/// </summary>
		public static void spEMAILS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_MassUpdate
		/// <summary>
		/// spEMAILS_MassUpdate
		/// </summary>
		public static IDbCommand cmdEMAILS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_OPPORTUNITIES_Delete
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spEMAILS_OPPORTUNITIES_Delete(Guid gEMAIL_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_OPPORTUNITIES_Delete
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spEMAILS_OPPORTUNITIES_Delete(Guid gEMAIL_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_OPPORTUNITIES_Delete
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_OPPORTUNITIES_Update
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Update
		/// </summary>
		public static void spEMAILS_OPPORTUNITIES_Update(Guid gEMAIL_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_OPPORTUNITIES_Update
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Update
		/// </summary>
		public static void spEMAILS_OPPORTUNITIES_Update(Guid gEMAIL_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_OPPORTUNITIES_Update
		/// <summary>
		/// spEMAILS_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROJECT_TASKS_Delete
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Delete
		/// </summary>
		public static void spEMAILS_PROJECT_TASKS_Delete(Guid gEMAIL_ID, Guid gPROJECT_TASK_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROJECT_TASKS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROJECT_TASK_ID  = Sql.AddParameter(cmd, "@PROJECT_TASK_ID" , gPROJECT_TASK_ID   );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROJECT_TASKS_Delete
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Delete
		/// </summary>
		public static void spEMAILS_PROJECT_TASKS_Delete(Guid gEMAIL_ID, Guid gPROJECT_TASK_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROJECT_TASKS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROJECT_TASK_ID  = Sql.AddParameter(cmd, "@PROJECT_TASK_ID" , gPROJECT_TASK_ID   );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROJECT_TASKS_Delete
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_PROJECT_TASKS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROJECT_TASKS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROJECT_TASK_ID  = Sql.CreateParameter(cmd, "@PROJECT_TASK_ID" , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROJECT_TASKS_Update
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Update
		/// </summary>
		public static void spEMAILS_PROJECT_TASKS_Update(Guid gEMAIL_ID, Guid gPROJECT_TASK_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROJECT_TASKS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROJECT_TASK_ID  = Sql.AddParameter(cmd, "@PROJECT_TASK_ID" , gPROJECT_TASK_ID   );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROJECT_TASKS_Update
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Update
		/// </summary>
		public static void spEMAILS_PROJECT_TASKS_Update(Guid gEMAIL_ID, Guid gPROJECT_TASK_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROJECT_TASKS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROJECT_TASK_ID  = Sql.AddParameter(cmd, "@PROJECT_TASK_ID" , gPROJECT_TASK_ID   );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROJECT_TASKS_Update
		/// <summary>
		/// spEMAILS_PROJECT_TASKS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_PROJECT_TASKS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROJECT_TASKS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROJECT_TASK_ID  = Sql.CreateParameter(cmd, "@PROJECT_TASK_ID" , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROJECTS_Delete
		/// <summary>
		/// spEMAILS_PROJECTS_Delete
		/// </summary>
		public static void spEMAILS_PROJECTS_Delete(Guid gEMAIL_ID, Guid gPROJECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROJECTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROJECTS_Delete
		/// <summary>
		/// spEMAILS_PROJECTS_Delete
		/// </summary>
		public static void spEMAILS_PROJECTS_Delete(Guid gEMAIL_ID, Guid gPROJECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROJECTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROJECTS_Delete
		/// <summary>
		/// spEMAILS_PROJECTS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_PROJECTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROJECTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROJECTS_Update
		/// <summary>
		/// spEMAILS_PROJECTS_Update
		/// </summary>
		public static void spEMAILS_PROJECTS_Update(Guid gEMAIL_ID, Guid gPROJECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROJECTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROJECTS_Update
		/// <summary>
		/// spEMAILS_PROJECTS_Update
		/// </summary>
		public static void spEMAILS_PROJECTS_Update(Guid gEMAIL_ID, Guid gPROJECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROJECTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROJECTS_Update
		/// <summary>
		/// spEMAILS_PROJECTS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_PROJECTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROJECTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROSPECTS_Delete
		/// <summary>
		/// spEMAILS_PROSPECTS_Delete
		/// </summary>
		public static void spEMAILS_PROSPECTS_Delete(Guid gEMAIL_ID, Guid gPROSPECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROSPECTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROSPECTS_Delete
		/// <summary>
		/// spEMAILS_PROSPECTS_Delete
		/// </summary>
		public static void spEMAILS_PROSPECTS_Delete(Guid gEMAIL_ID, Guid gPROSPECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROSPECTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROSPECTS_Delete
		/// <summary>
		/// spEMAILS_PROSPECTS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_PROSPECTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROSPECTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROSPECT_ID      = Sql.CreateParameter(cmd, "@PROSPECT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_PROSPECTS_Update
		/// <summary>
		/// spEMAILS_PROSPECTS_Update
		/// </summary>
		public static void spEMAILS_PROSPECTS_Update(Guid gEMAIL_ID, Guid gPROSPECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_PROSPECTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_PROSPECTS_Update
		/// <summary>
		/// spEMAILS_PROSPECTS_Update
		/// </summary>
		public static void spEMAILS_PROSPECTS_Update(Guid gEMAIL_ID, Guid gPROSPECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_PROSPECTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_PROSPECTS_Update
		/// <summary>
		/// spEMAILS_PROSPECTS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_PROSPECTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_PROSPECTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parPROSPECT_ID      = Sql.CreateParameter(cmd, "@PROSPECT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_QUOTES_Delete
		/// <summary>
		/// spEMAILS_QUOTES_Delete
		/// </summary>
		public static void spEMAILS_QUOTES_Delete(Guid gEMAIL_ID, Guid gQUOTE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_QUOTES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_QUOTES_Delete
		/// <summary>
		/// spEMAILS_QUOTES_Delete
		/// </summary>
		public static void spEMAILS_QUOTES_Delete(Guid gEMAIL_ID, Guid gQUOTE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_QUOTES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_QUOTES_Delete
		/// <summary>
		/// spEMAILS_QUOTES_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_QUOTES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_QUOTES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_QUOTES_Update
		/// <summary>
		/// spEMAILS_QUOTES_Update
		/// </summary>
		public static void spEMAILS_QUOTES_Update(Guid gEMAIL_ID, Guid gQUOTE_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_QUOTES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_QUOTES_Update
		/// <summary>
		/// spEMAILS_QUOTES_Update
		/// </summary>
		public static void spEMAILS_QUOTES_Update(Guid gEMAIL_ID, Guid gQUOTE_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_QUOTES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_QUOTES_Update
		/// <summary>
		/// spEMAILS_QUOTES_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_QUOTES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_QUOTES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_TASKS_Delete
		/// <summary>
		/// spEMAILS_TASKS_Delete
		/// </summary>
		public static void spEMAILS_TASKS_Delete(Guid gEMAIL_ID, Guid gTASK_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_TASKS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parTASK_ID          = Sql.AddParameter(cmd, "@TASK_ID"         , gTASK_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_TASKS_Delete
		/// <summary>
		/// spEMAILS_TASKS_Delete
		/// </summary>
		public static void spEMAILS_TASKS_Delete(Guid gEMAIL_ID, Guid gTASK_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_TASKS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parTASK_ID          = Sql.AddParameter(cmd, "@TASK_ID"         , gTASK_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_TASKS_Delete
		/// <summary>
		/// spEMAILS_TASKS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_TASKS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_TASKS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parTASK_ID          = Sql.CreateParameter(cmd, "@TASK_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_TASKS_Update
		/// <summary>
		/// spEMAILS_TASKS_Update
		/// </summary>
		public static void spEMAILS_TASKS_Update(Guid gEMAIL_ID, Guid gTASK_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_TASKS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parTASK_ID          = Sql.AddParameter(cmd, "@TASK_ID"         , gTASK_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_TASKS_Update
		/// <summary>
		/// spEMAILS_TASKS_Update
		/// </summary>
		public static void spEMAILS_TASKS_Update(Guid gEMAIL_ID, Guid gTASK_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_TASKS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parTASK_ID          = Sql.AddParameter(cmd, "@TASK_ID"         , gTASK_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_TASKS_Update
		/// <summary>
		/// spEMAILS_TASKS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_TASKS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_TASKS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parTASK_ID          = Sql.CreateParameter(cmd, "@TASK_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_Update
		/// <summary>
		/// spEMAILS_Update
		/// </summary>
		public static void spEMAILS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, DateTime dtDATE_TIME, string sPARENT_TYPE, Guid gPARENT_ID, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sCC_ADDRS, string sBCC_ADDRS, string sTO_ADDRS_IDS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sCC_ADDRS_IDS, string sCC_ADDRS_NAMES, string sCC_ADDRS_EMAILS, string sBCC_ADDRS_IDS, string sBCC_ADDRS_NAMES, string sBCC_ADDRS_EMAILS, string sTYPE, string sMESSAGE_ID, string sREPLY_TO_NAME, string sREPLY_TO_ADDR, string sINTENT, Guid gMAILBOX_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
							IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
							IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
							IDbDataParameter parTO_ADDRS         = Sql.AddParameter(cmd, "@TO_ADDRS"        , sTO_ADDRS          );
							IDbDataParameter parCC_ADDRS         = Sql.AddParameter(cmd, "@CC_ADDRS"        , sCC_ADDRS          );
							IDbDataParameter parBCC_ADDRS        = Sql.AddParameter(cmd, "@BCC_ADDRS"       , sBCC_ADDRS         );
							IDbDataParameter parTO_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@TO_ADDRS_IDS"    , sTO_ADDRS_IDS      , 8000);
							IDbDataParameter parTO_ADDRS_NAMES   = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"  , sTO_ADDRS_NAMES    );
							IDbDataParameter parTO_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@TO_ADDRS_EMAILS" , sTO_ADDRS_EMAILS   );
							IDbDataParameter parCC_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@CC_ADDRS_IDS"    , sCC_ADDRS_IDS      , 8000);
							IDbDataParameter parCC_ADDRS_NAMES   = Sql.AddParameter(cmd, "@CC_ADDRS_NAMES"  , sCC_ADDRS_NAMES    );
							IDbDataParameter parCC_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@CC_ADDRS_EMAILS" , sCC_ADDRS_EMAILS   );
							IDbDataParameter parBCC_ADDRS_IDS    = Sql.AddAnsiParam(cmd, "@BCC_ADDRS_IDS"   , sBCC_ADDRS_IDS     , 8000);
							IDbDataParameter parBCC_ADDRS_NAMES  = Sql.AddParameter(cmd, "@BCC_ADDRS_NAMES" , sBCC_ADDRS_NAMES   );
							IDbDataParameter parBCC_ADDRS_EMAILS = Sql.AddParameter(cmd, "@BCC_ADDRS_EMAILS", sBCC_ADDRS_EMAILS  );
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
							IDbDataParameter parMESSAGE_ID       = Sql.AddParameter(cmd, "@MESSAGE_ID"      , sMESSAGE_ID        , 100);
							IDbDataParameter parREPLY_TO_NAME    = Sql.AddParameter(cmd, "@REPLY_TO_NAME"   , sREPLY_TO_NAME     , 100);
							IDbDataParameter parREPLY_TO_ADDR    = Sql.AddParameter(cmd, "@REPLY_TO_ADDR"   , sREPLY_TO_ADDR     , 100);
							IDbDataParameter parINTENT           = Sql.AddParameter(cmd, "@INTENT"          , sINTENT            ,  25);
							IDbDataParameter parMAILBOX_ID       = Sql.AddParameter(cmd, "@MAILBOX_ID"      , gMAILBOX_ID        );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_Update
		/// <summary>
		/// spEMAILS_Update
		/// </summary>
		public static void spEMAILS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, DateTime dtDATE_TIME, string sPARENT_TYPE, Guid gPARENT_ID, string sDESCRIPTION, string sDESCRIPTION_HTML, string sFROM_ADDR, string sFROM_NAME, string sTO_ADDRS, string sCC_ADDRS, string sBCC_ADDRS, string sTO_ADDRS_IDS, string sTO_ADDRS_NAMES, string sTO_ADDRS_EMAILS, string sCC_ADDRS_IDS, string sCC_ADDRS_NAMES, string sCC_ADDRS_EMAILS, string sBCC_ADDRS_IDS, string sBCC_ADDRS_NAMES, string sBCC_ADDRS_EMAILS, string sTYPE, string sMESSAGE_ID, string sREPLY_TO_NAME, string sREPLY_TO_ADDR, string sINTENT, Guid gMAILBOX_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
				IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
				IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
				IDbDataParameter parTO_ADDRS         = Sql.AddParameter(cmd, "@TO_ADDRS"        , sTO_ADDRS          );
				IDbDataParameter parCC_ADDRS         = Sql.AddParameter(cmd, "@CC_ADDRS"        , sCC_ADDRS          );
				IDbDataParameter parBCC_ADDRS        = Sql.AddParameter(cmd, "@BCC_ADDRS"       , sBCC_ADDRS         );
				IDbDataParameter parTO_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@TO_ADDRS_IDS"    , sTO_ADDRS_IDS      , 8000);
				IDbDataParameter parTO_ADDRS_NAMES   = Sql.AddParameter(cmd, "@TO_ADDRS_NAMES"  , sTO_ADDRS_NAMES    );
				IDbDataParameter parTO_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@TO_ADDRS_EMAILS" , sTO_ADDRS_EMAILS   );
				IDbDataParameter parCC_ADDRS_IDS     = Sql.AddAnsiParam(cmd, "@CC_ADDRS_IDS"    , sCC_ADDRS_IDS      , 8000);
				IDbDataParameter parCC_ADDRS_NAMES   = Sql.AddParameter(cmd, "@CC_ADDRS_NAMES"  , sCC_ADDRS_NAMES    );
				IDbDataParameter parCC_ADDRS_EMAILS  = Sql.AddParameter(cmd, "@CC_ADDRS_EMAILS" , sCC_ADDRS_EMAILS   );
				IDbDataParameter parBCC_ADDRS_IDS    = Sql.AddAnsiParam(cmd, "@BCC_ADDRS_IDS"   , sBCC_ADDRS_IDS     , 8000);
				IDbDataParameter parBCC_ADDRS_NAMES  = Sql.AddParameter(cmd, "@BCC_ADDRS_NAMES" , sBCC_ADDRS_NAMES   );
				IDbDataParameter parBCC_ADDRS_EMAILS = Sql.AddParameter(cmd, "@BCC_ADDRS_EMAILS", sBCC_ADDRS_EMAILS  );
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
				IDbDataParameter parMESSAGE_ID       = Sql.AddParameter(cmd, "@MESSAGE_ID"      , sMESSAGE_ID        , 100);
				IDbDataParameter parREPLY_TO_NAME    = Sql.AddParameter(cmd, "@REPLY_TO_NAME"   , sREPLY_TO_NAME     , 100);
				IDbDataParameter parREPLY_TO_ADDR    = Sql.AddParameter(cmd, "@REPLY_TO_ADDR"   , sREPLY_TO_ADDR     , 100);
				IDbDataParameter parINTENT           = Sql.AddParameter(cmd, "@INTENT"          , sINTENT            ,  25);
				IDbDataParameter parMAILBOX_ID       = Sql.AddParameter(cmd, "@MAILBOX_ID"      , gMAILBOX_ID        );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMAILS_Update
		/// <summary>
		/// spEMAILS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parDESCRIPTION_HTML = Sql.CreateParameter(cmd, "@DESCRIPTION_HTML", "string", 104857600);
			IDbDataParameter parFROM_ADDR        = Sql.CreateParameter(cmd, "@FROM_ADDR"       , "string", 100);
			IDbDataParameter parFROM_NAME        = Sql.CreateParameter(cmd, "@FROM_NAME"       , "string", 100);
			IDbDataParameter parTO_ADDRS         = Sql.CreateParameter(cmd, "@TO_ADDRS"        , "string", 104857600);
			IDbDataParameter parCC_ADDRS         = Sql.CreateParameter(cmd, "@CC_ADDRS"        , "string", 104857600);
			IDbDataParameter parBCC_ADDRS        = Sql.CreateParameter(cmd, "@BCC_ADDRS"       , "string", 104857600);
			IDbDataParameter parTO_ADDRS_IDS     = Sql.CreateParameter(cmd, "@TO_ADDRS_IDS"    , "ansistring", 8000);
			IDbDataParameter parTO_ADDRS_NAMES   = Sql.CreateParameter(cmd, "@TO_ADDRS_NAMES"  , "string", 104857600);
			IDbDataParameter parTO_ADDRS_EMAILS  = Sql.CreateParameter(cmd, "@TO_ADDRS_EMAILS" , "string", 104857600);
			IDbDataParameter parCC_ADDRS_IDS     = Sql.CreateParameter(cmd, "@CC_ADDRS_IDS"    , "ansistring", 8000);
			IDbDataParameter parCC_ADDRS_NAMES   = Sql.CreateParameter(cmd, "@CC_ADDRS_NAMES"  , "string", 104857600);
			IDbDataParameter parCC_ADDRS_EMAILS  = Sql.CreateParameter(cmd, "@CC_ADDRS_EMAILS" , "string", 104857600);
			IDbDataParameter parBCC_ADDRS_IDS    = Sql.CreateParameter(cmd, "@BCC_ADDRS_IDS"   , "ansistring", 8000);
			IDbDataParameter parBCC_ADDRS_NAMES  = Sql.CreateParameter(cmd, "@BCC_ADDRS_NAMES" , "string", 104857600);
			IDbDataParameter parBCC_ADDRS_EMAILS = Sql.CreateParameter(cmd, "@BCC_ADDRS_EMAILS", "string", 104857600);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string",  25);
			IDbDataParameter parMESSAGE_ID       = Sql.CreateParameter(cmd, "@MESSAGE_ID"      , "string", 100);
			IDbDataParameter parREPLY_TO_NAME    = Sql.CreateParameter(cmd, "@REPLY_TO_NAME"   , "string", 100);
			IDbDataParameter parREPLY_TO_ADDR    = Sql.CreateParameter(cmd, "@REPLY_TO_ADDR"   , "string", 100);
			IDbDataParameter parINTENT           = Sql.CreateParameter(cmd, "@INTENT"          , "string",  25);
			IDbDataParameter parMAILBOX_ID       = Sql.CreateParameter(cmd, "@MAILBOX_ID"      , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spEMAILS_UpdateStatus
		/// <summary>
		/// spEMAILS_UpdateStatus
		/// </summary>
		public static void spEMAILS_UpdateStatus(Guid gID, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_UpdateStatus";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_UpdateStatus
		/// <summary>
		/// spEMAILS_UpdateStatus
		/// </summary>
		public static void spEMAILS_UpdateStatus(Guid gID, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_UpdateStatus";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_UpdateStatus
		/// <summary>
		/// spEMAILS_UpdateStatus
		/// </summary>
		public static IDbCommand cmdEMAILS_UpdateStatus(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_UpdateStatus";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			return cmd;
		}
		#endregion

		#region spEMAILS_USERS_Delete
		/// <summary>
		/// spEMAILS_USERS_Delete
		/// </summary>
		public static void spEMAILS_USERS_Delete(Guid gEMAIL_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_USERS_Delete
		/// <summary>
		/// spEMAILS_USERS_Delete
		/// </summary>
		public static void spEMAILS_USERS_Delete(Guid gEMAIL_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_USERS_Delete
		/// <summary>
		/// spEMAILS_USERS_Delete
		/// </summary>
		public static IDbCommand cmdEMAILS_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMAILS_USERS_Update
		/// <summary>
		/// spEMAILS_USERS_Update
		/// </summary>
		public static void spEMAILS_USERS_Update(Guid gEMAIL_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMAILS_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMAILS_USERS_Update
		/// <summary>
		/// spEMAILS_USERS_Update
		/// </summary>
		public static void spEMAILS_USERS_Update(Guid gEMAIL_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMAILS_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parEMAIL_ID         = Sql.AddParameter(cmd, "@EMAIL_ID"        , gEMAIL_ID          );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdEMAILS_USERS_Update
		/// <summary>
		/// spEMAILS_USERS_Update
		/// </summary>
		public static IDbCommand cmdEMAILS_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMAILS_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parEMAIL_ID         = Sql.CreateParameter(cmd, "@EMAIL_ID"        , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spEMPLOYEES_Update
		/// <summary>
		/// spEMPLOYEES_Update
		/// </summary>
		public static void spEMPLOYEES_Update(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, Guid gREPORTS_TO_ID, string sDESCRIPTION, string sTITLE, string sDEPARTMENT, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sADDRESS_STREET, string sADDRESS_CITY, string sADDRESS_STATE, string sADDRESS_POSTALCODE, string sADDRESS_COUNTRY, string sEMPLOYEE_STATUS, string sMESSENGER_ID, string sMESSENGER_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spEMPLOYEES_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parFIRST_NAME         = Sql.AddParameter(cmd, "@FIRST_NAME"        , sFIRST_NAME          ,  30);
							IDbDataParameter parLAST_NAME          = Sql.AddParameter(cmd, "@LAST_NAME"         , sLAST_NAME           ,  30);
							IDbDataParameter parREPORTS_TO_ID      = Sql.AddParameter(cmd, "@REPORTS_TO_ID"     , gREPORTS_TO_ID       );
							IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
							IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               ,  50);
							IDbDataParameter parDEPARTMENT         = Sql.AddParameter(cmd, "@DEPARTMENT"        , sDEPARTMENT          ,  50);
							IDbDataParameter parPHONE_HOME         = Sql.AddParameter(cmd, "@PHONE_HOME"        , sPHONE_HOME          ,  50);
							IDbDataParameter parPHONE_MOBILE       = Sql.AddParameter(cmd, "@PHONE_MOBILE"      , sPHONE_MOBILE        ,  50);
							IDbDataParameter parPHONE_WORK         = Sql.AddParameter(cmd, "@PHONE_WORK"        , sPHONE_WORK          ,  50);
							IDbDataParameter parPHONE_OTHER        = Sql.AddParameter(cmd, "@PHONE_OTHER"       , sPHONE_OTHER         ,  50);
							IDbDataParameter parPHONE_FAX          = Sql.AddParameter(cmd, "@PHONE_FAX"         , sPHONE_FAX           ,  50);
							IDbDataParameter parEMAIL1             = Sql.AddParameter(cmd, "@EMAIL1"            , sEMAIL1              , 100);
							IDbDataParameter parEMAIL2             = Sql.AddParameter(cmd, "@EMAIL2"            , sEMAIL2              , 100);
							IDbDataParameter parADDRESS_STREET     = Sql.AddParameter(cmd, "@ADDRESS_STREET"    , sADDRESS_STREET      , 150);
							IDbDataParameter parADDRESS_CITY       = Sql.AddParameter(cmd, "@ADDRESS_CITY"      , sADDRESS_CITY        , 100);
							IDbDataParameter parADDRESS_STATE      = Sql.AddParameter(cmd, "@ADDRESS_STATE"     , sADDRESS_STATE       , 100);
							IDbDataParameter parADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@ADDRESS_POSTALCODE", sADDRESS_POSTALCODE  ,   9);
							IDbDataParameter parADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@ADDRESS_COUNTRY"   , sADDRESS_COUNTRY     ,  25);
							IDbDataParameter parEMPLOYEE_STATUS    = Sql.AddParameter(cmd, "@EMPLOYEE_STATUS"   , sEMPLOYEE_STATUS     ,  25);
							IDbDataParameter parMESSENGER_ID       = Sql.AddParameter(cmd, "@MESSENGER_ID"      , sMESSENGER_ID        ,  25);
							IDbDataParameter parMESSENGER_TYPE     = Sql.AddParameter(cmd, "@MESSENGER_TYPE"    , sMESSENGER_TYPE      ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spEMPLOYEES_Update
		/// <summary>
		/// spEMPLOYEES_Update
		/// </summary>
		public static void spEMPLOYEES_Update(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, Guid gREPORTS_TO_ID, string sDESCRIPTION, string sTITLE, string sDEPARTMENT, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sADDRESS_STREET, string sADDRESS_CITY, string sADDRESS_STATE, string sADDRESS_POSTALCODE, string sADDRESS_COUNTRY, string sEMPLOYEE_STATUS, string sMESSENGER_ID, string sMESSENGER_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spEMPLOYEES_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parFIRST_NAME         = Sql.AddParameter(cmd, "@FIRST_NAME"        , sFIRST_NAME          ,  30);
				IDbDataParameter parLAST_NAME          = Sql.AddParameter(cmd, "@LAST_NAME"         , sLAST_NAME           ,  30);
				IDbDataParameter parREPORTS_TO_ID      = Sql.AddParameter(cmd, "@REPORTS_TO_ID"     , gREPORTS_TO_ID       );
				IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
				IDbDataParameter parTITLE              = Sql.AddParameter(cmd, "@TITLE"             , sTITLE               ,  50);
				IDbDataParameter parDEPARTMENT         = Sql.AddParameter(cmd, "@DEPARTMENT"        , sDEPARTMENT          ,  50);
				IDbDataParameter parPHONE_HOME         = Sql.AddParameter(cmd, "@PHONE_HOME"        , sPHONE_HOME          ,  50);
				IDbDataParameter parPHONE_MOBILE       = Sql.AddParameter(cmd, "@PHONE_MOBILE"      , sPHONE_MOBILE        ,  50);
				IDbDataParameter parPHONE_WORK         = Sql.AddParameter(cmd, "@PHONE_WORK"        , sPHONE_WORK          ,  50);
				IDbDataParameter parPHONE_OTHER        = Sql.AddParameter(cmd, "@PHONE_OTHER"       , sPHONE_OTHER         ,  50);
				IDbDataParameter parPHONE_FAX          = Sql.AddParameter(cmd, "@PHONE_FAX"         , sPHONE_FAX           ,  50);
				IDbDataParameter parEMAIL1             = Sql.AddParameter(cmd, "@EMAIL1"            , sEMAIL1              , 100);
				IDbDataParameter parEMAIL2             = Sql.AddParameter(cmd, "@EMAIL2"            , sEMAIL2              , 100);
				IDbDataParameter parADDRESS_STREET     = Sql.AddParameter(cmd, "@ADDRESS_STREET"    , sADDRESS_STREET      , 150);
				IDbDataParameter parADDRESS_CITY       = Sql.AddParameter(cmd, "@ADDRESS_CITY"      , sADDRESS_CITY        , 100);
				IDbDataParameter parADDRESS_STATE      = Sql.AddParameter(cmd, "@ADDRESS_STATE"     , sADDRESS_STATE       , 100);
				IDbDataParameter parADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@ADDRESS_POSTALCODE", sADDRESS_POSTALCODE  ,   9);
				IDbDataParameter parADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@ADDRESS_COUNTRY"   , sADDRESS_COUNTRY     ,  25);
				IDbDataParameter parEMPLOYEE_STATUS    = Sql.AddParameter(cmd, "@EMPLOYEE_STATUS"   , sEMPLOYEE_STATUS     ,  25);
				IDbDataParameter parMESSENGER_ID       = Sql.AddParameter(cmd, "@MESSENGER_ID"      , sMESSENGER_ID        ,  25);
				IDbDataParameter parMESSENGER_TYPE     = Sql.AddParameter(cmd, "@MESSENGER_TYPE"    , sMESSENGER_TYPE      ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdEMPLOYEES_Update
		/// <summary>
		/// spEMPLOYEES_Update
		/// </summary>
		public static IDbCommand cmdEMPLOYEES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spEMPLOYEES_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parFIRST_NAME         = Sql.CreateParameter(cmd, "@FIRST_NAME"        , "string",  30);
			IDbDataParameter parLAST_NAME          = Sql.CreateParameter(cmd, "@LAST_NAME"         , "string",  30);
			IDbDataParameter parREPORTS_TO_ID      = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"     , "Guid",  16);
			IDbDataParameter parDESCRIPTION        = Sql.CreateParameter(cmd, "@DESCRIPTION"       , "string", 104857600);
			IDbDataParameter parTITLE              = Sql.CreateParameter(cmd, "@TITLE"             , "string",  50);
			IDbDataParameter parDEPARTMENT         = Sql.CreateParameter(cmd, "@DEPARTMENT"        , "string",  50);
			IDbDataParameter parPHONE_HOME         = Sql.CreateParameter(cmd, "@PHONE_HOME"        , "string",  50);
			IDbDataParameter parPHONE_MOBILE       = Sql.CreateParameter(cmd, "@PHONE_MOBILE"      , "string",  50);
			IDbDataParameter parPHONE_WORK         = Sql.CreateParameter(cmd, "@PHONE_WORK"        , "string",  50);
			IDbDataParameter parPHONE_OTHER        = Sql.CreateParameter(cmd, "@PHONE_OTHER"       , "string",  50);
			IDbDataParameter parPHONE_FAX          = Sql.CreateParameter(cmd, "@PHONE_FAX"         , "string",  50);
			IDbDataParameter parEMAIL1             = Sql.CreateParameter(cmd, "@EMAIL1"            , "string", 100);
			IDbDataParameter parEMAIL2             = Sql.CreateParameter(cmd, "@EMAIL2"            , "string", 100);
			IDbDataParameter parADDRESS_STREET     = Sql.CreateParameter(cmd, "@ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parADDRESS_CITY       = Sql.CreateParameter(cmd, "@ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parADDRESS_STATE      = Sql.CreateParameter(cmd, "@ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@ADDRESS_POSTALCODE", "string",   9);
			IDbDataParameter parADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@ADDRESS_COUNTRY"   , "string",  25);
			IDbDataParameter parEMPLOYEE_STATUS    = Sql.CreateParameter(cmd, "@EMPLOYEE_STATUS"   , "string",  25);
			IDbDataParameter parMESSENGER_ID       = Sql.CreateParameter(cmd, "@MESSENGER_ID"      , "string",  25);
			IDbDataParameter parMESSENGER_TYPE     = Sql.CreateParameter(cmd, "@MESSENGER_TYPE"    , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFEEDS_Delete
		/// <summary>
		/// spFEEDS_Delete
		/// </summary>
		public static void spFEEDS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFEEDS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFEEDS_Delete
		/// <summary>
		/// spFEEDS_Delete
		/// </summary>
		public static void spFEEDS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFEEDS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFEEDS_Delete
		/// <summary>
		/// spFEEDS_Delete
		/// </summary>
		public static IDbCommand cmdFEEDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFEEDS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFEEDS_New
		/// <summary>
		/// spFEEDS_New
		/// </summary>
		public static void spFEEDS_New(ref Guid gID, string sURL)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFEEDS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFEEDS_New
		/// <summary>
		/// spFEEDS_New
		/// </summary>
		public static void spFEEDS_New(ref Guid gID, string sURL, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFEEDS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFEEDS_New
		/// <summary>
		/// spFEEDS_New
		/// </summary>
		public static IDbCommand cmdFEEDS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFEEDS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parURL              = Sql.CreateParameter(cmd, "@URL"             , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFEEDS_Update
		/// <summary>
		/// spFEEDS_Update
		/// </summary>
		public static void spFEEDS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sTITLE, string sDESCRIPTION, string sURL, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFEEDS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 100);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFEEDS_Update
		/// <summary>
		/// spFEEDS_Update
		/// </summary>
		public static void spFEEDS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sTITLE, string sDESCRIPTION, string sURL, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFEEDS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 100);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFEEDS_Update
		/// <summary>
		/// spFEEDS_Update
		/// </summary>
		public static IDbCommand cmdFEEDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFEEDS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parTITLE            = Sql.CreateParameter(cmd, "@TITLE"           , "string", 100);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parURL              = Sql.CreateParameter(cmd, "@URL"             , "string", 255);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFIELDS_META_DATA_Delete
		/// <summary>
		/// spFIELDS_META_DATA_Delete
		/// </summary>
		public static void spFIELDS_META_DATA_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFIELDS_META_DATA_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFIELDS_META_DATA_Delete
		/// <summary>
		/// spFIELDS_META_DATA_Delete
		/// </summary>
		public static void spFIELDS_META_DATA_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFIELDS_META_DATA_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFIELDS_META_DATA_Delete
		/// <summary>
		/// spFIELDS_META_DATA_Delete
		/// </summary>
		public static IDbCommand cmdFIELDS_META_DATA_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFIELDS_META_DATA_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFIELDS_META_DATA_Insert
		/// <summary>
		/// spFIELDS_META_DATA_Insert
		/// </summary>
		public static void spFIELDS_META_DATA_Insert(ref Guid gID, string sNAME, string sLABEL, string sLABEL_TERM, string sCUSTOM_MODULE, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, bool bAUDITED, string sDEFAULT_VALUE, string sDROPDOWN_LIST, bool bMASS_UPDATE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFIELDS_META_DATA_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parLABEL            = Sql.AddParameter(cmd, "@LABEL"           , sLABEL             , 255);
							IDbDataParameter parLABEL_TERM       = Sql.AddParameter(cmd, "@LABEL_TERM"      , sLABEL_TERM        , 255);
							IDbDataParameter parCUSTOM_MODULE    = Sql.AddParameter(cmd, "@CUSTOM_MODULE"   , sCUSTOM_MODULE     , 255);
							IDbDataParameter parDATA_TYPE        = Sql.AddParameter(cmd, "@DATA_TYPE"       , sDATA_TYPE         , 255);
							IDbDataParameter parMAX_SIZE         = Sql.AddParameter(cmd, "@MAX_SIZE"        , nMAX_SIZE          );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parAUDITED          = Sql.AddParameter(cmd, "@AUDITED"         , bAUDITED           );
							IDbDataParameter parDEFAULT_VALUE    = Sql.AddParameter(cmd, "@DEFAULT_VALUE"   , sDEFAULT_VALUE     , 255);
							IDbDataParameter parDROPDOWN_LIST    = Sql.AddParameter(cmd, "@DROPDOWN_LIST"   , sDROPDOWN_LIST     ,  50);
							IDbDataParameter parMASS_UPDATE      = Sql.AddParameter(cmd, "@MASS_UPDATE"     , bMASS_UPDATE       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFIELDS_META_DATA_Insert
		/// <summary>
		/// spFIELDS_META_DATA_Insert
		/// </summary>
		public static void spFIELDS_META_DATA_Insert(ref Guid gID, string sNAME, string sLABEL, string sLABEL_TERM, string sCUSTOM_MODULE, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, bool bAUDITED, string sDEFAULT_VALUE, string sDROPDOWN_LIST, bool bMASS_UPDATE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFIELDS_META_DATA_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parLABEL            = Sql.AddParameter(cmd, "@LABEL"           , sLABEL             , 255);
				IDbDataParameter parLABEL_TERM       = Sql.AddParameter(cmd, "@LABEL_TERM"      , sLABEL_TERM        , 255);
				IDbDataParameter parCUSTOM_MODULE    = Sql.AddParameter(cmd, "@CUSTOM_MODULE"   , sCUSTOM_MODULE     , 255);
				IDbDataParameter parDATA_TYPE        = Sql.AddParameter(cmd, "@DATA_TYPE"       , sDATA_TYPE         , 255);
				IDbDataParameter parMAX_SIZE         = Sql.AddParameter(cmd, "@MAX_SIZE"        , nMAX_SIZE          );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parAUDITED          = Sql.AddParameter(cmd, "@AUDITED"         , bAUDITED           );
				IDbDataParameter parDEFAULT_VALUE    = Sql.AddParameter(cmd, "@DEFAULT_VALUE"   , sDEFAULT_VALUE     , 255);
				IDbDataParameter parDROPDOWN_LIST    = Sql.AddParameter(cmd, "@DROPDOWN_LIST"   , sDROPDOWN_LIST     ,  50);
				IDbDataParameter parMASS_UPDATE      = Sql.AddParameter(cmd, "@MASS_UPDATE"     , bMASS_UPDATE       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFIELDS_META_DATA_Insert
		/// <summary>
		/// spFIELDS_META_DATA_Insert
		/// </summary>
		public static IDbCommand cmdFIELDS_META_DATA_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFIELDS_META_DATA_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parLABEL            = Sql.CreateParameter(cmd, "@LABEL"           , "string", 255);
			IDbDataParameter parLABEL_TERM       = Sql.CreateParameter(cmd, "@LABEL_TERM"      , "string", 255);
			IDbDataParameter parCUSTOM_MODULE    = Sql.CreateParameter(cmd, "@CUSTOM_MODULE"   , "string", 255);
			IDbDataParameter parDATA_TYPE        = Sql.CreateParameter(cmd, "@DATA_TYPE"       , "string", 255);
			IDbDataParameter parMAX_SIZE         = Sql.CreateParameter(cmd, "@MAX_SIZE"        , "Int32",   4);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parAUDITED          = Sql.CreateParameter(cmd, "@AUDITED"         , "bool",   1);
			IDbDataParameter parDEFAULT_VALUE    = Sql.CreateParameter(cmd, "@DEFAULT_VALUE"   , "string", 255);
			IDbDataParameter parDROPDOWN_LIST    = Sql.CreateParameter(cmd, "@DROPDOWN_LIST"   , "string",  50);
			IDbDataParameter parMASS_UPDATE      = Sql.CreateParameter(cmd, "@MASS_UPDATE"     , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFIELDS_META_DATA_Update
		/// <summary>
		/// spFIELDS_META_DATA_Update
		/// </summary>
		public static void spFIELDS_META_DATA_Update(Guid gID, Int32 nMAX_SIZE, bool bREQUIRED, bool bAUDITED, string sDEFAULT_VALUE, string sDROPDOWN_LIST, bool bMASS_UPDATE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFIELDS_META_DATA_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMAX_SIZE         = Sql.AddParameter(cmd, "@MAX_SIZE"        , nMAX_SIZE          );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parAUDITED          = Sql.AddParameter(cmd, "@AUDITED"         , bAUDITED           );
							IDbDataParameter parDEFAULT_VALUE    = Sql.AddParameter(cmd, "@DEFAULT_VALUE"   , sDEFAULT_VALUE     , 255);
							IDbDataParameter parDROPDOWN_LIST    = Sql.AddParameter(cmd, "@DROPDOWN_LIST"   , sDROPDOWN_LIST     ,  50);
							IDbDataParameter parMASS_UPDATE      = Sql.AddParameter(cmd, "@MASS_UPDATE"     , bMASS_UPDATE       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFIELDS_META_DATA_Update
		/// <summary>
		/// spFIELDS_META_DATA_Update
		/// </summary>
		public static void spFIELDS_META_DATA_Update(Guid gID, Int32 nMAX_SIZE, bool bREQUIRED, bool bAUDITED, string sDEFAULT_VALUE, string sDROPDOWN_LIST, bool bMASS_UPDATE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFIELDS_META_DATA_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMAX_SIZE         = Sql.AddParameter(cmd, "@MAX_SIZE"        , nMAX_SIZE          );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parAUDITED          = Sql.AddParameter(cmd, "@AUDITED"         , bAUDITED           );
				IDbDataParameter parDEFAULT_VALUE    = Sql.AddParameter(cmd, "@DEFAULT_VALUE"   , sDEFAULT_VALUE     , 255);
				IDbDataParameter parDROPDOWN_LIST    = Sql.AddParameter(cmd, "@DROPDOWN_LIST"   , sDROPDOWN_LIST     ,  50);
				IDbDataParameter parMASS_UPDATE      = Sql.AddParameter(cmd, "@MASS_UPDATE"     , bMASS_UPDATE       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFIELDS_META_DATA_Update
		/// <summary>
		/// spFIELDS_META_DATA_Update
		/// </summary>
		public static IDbCommand cmdFIELDS_META_DATA_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFIELDS_META_DATA_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMAX_SIZE         = Sql.CreateParameter(cmd, "@MAX_SIZE"        , "Int32",   4);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parAUDITED          = Sql.CreateParameter(cmd, "@AUDITED"         , "bool",   1);
			IDbDataParameter parDEFAULT_VALUE    = Sql.CreateParameter(cmd, "@DEFAULT_VALUE"   , "string", 255);
			IDbDataParameter parDROPDOWN_LIST    = Sql.CreateParameter(cmd, "@DROPDOWN_LIST"   , "string",  50);
			IDbDataParameter parMASS_UPDATE      = Sql.CreateParameter(cmd, "@MASS_UPDATE"     , "bool",   1);
			return cmd;
		}
		#endregion

		#region spFILES_Delete
		/// <summary>
		/// spFILES_Delete
		/// </summary>
		public static void spFILES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFILES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFILES_Delete
		/// <summary>
		/// spFILES_Delete
		/// </summary>
		public static void spFILES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFILES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFILES_Delete
		/// <summary>
		/// spFILES_Delete
		/// </summary>
		public static IDbCommand cmdFILES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFILES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFILES_Update
		/// <summary>
		/// spFILES_Update
		/// </summary>
		public static void spFILES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFILES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFILES_Update
		/// <summary>
		/// spFILES_Update
		/// </summary>
		public static void spFILES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFILES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFILES_Update
		/// <summary>
		/// spFILES_Update
		/// </summary>
		public static IDbCommand cmdFILES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFILES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFORECASTS_Delete
		/// <summary>
		/// spFORECASTS_Delete
		/// </summary>
		public static void spFORECASTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORECASTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORECASTS_Delete
		/// <summary>
		/// spFORECASTS_Delete
		/// </summary>
		public static void spFORECASTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORECASTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORECASTS_Delete
		/// <summary>
		/// spFORECASTS_Delete
		/// </summary>
		public static IDbCommand cmdFORECASTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORECASTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFORECASTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spFORECASTS_OPPORTUNITIES_Delete(Guid gFORECAST_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Dele";
							else
								cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFORECAST_ID      = Sql.AddParameter(cmd, "@FORECAST_ID"     , gFORECAST_ID       );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORECASTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spFORECASTS_OPPORTUNITIES_Delete(Guid gFORECAST_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Dele";
				else
					cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFORECAST_ID      = Sql.AddParameter(cmd, "@FORECAST_ID"     , gFORECAST_ID       );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORECASTS_OPPORTUNITIES_Delete
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdFORECASTS_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Dele";
			else
				cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFORECAST_ID      = Sql.CreateParameter(cmd, "@FORECAST_ID"     , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFORECASTS_OPPORTUNITIES_Update
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spFORECASTS_OPPORTUNITIES_Update(Guid gFORECAST_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Upda";
							else
								cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFORECAST_ID      = Sql.AddParameter(cmd, "@FORECAST_ID"     , gFORECAST_ID       );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORECASTS_OPPORTUNITIES_Update
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Update
		/// </summary>
		public static void spFORECASTS_OPPORTUNITIES_Update(Guid gFORECAST_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Upda";
				else
					cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFORECAST_ID      = Sql.AddParameter(cmd, "@FORECAST_ID"     , gFORECAST_ID       );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORECASTS_OPPORTUNITIES_Update
		/// <summary>
		/// spFORECASTS_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdFORECASTS_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Upda";
			else
				cmd.CommandText = "spFORECASTS_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFORECAST_ID      = Sql.CreateParameter(cmd, "@FORECAST_ID"     , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFORECASTS_Update
		/// <summary>
		/// spFORECASTS_Update
		/// </summary>
		public static void spFORECASTS_Update(ref Guid gID, Guid gTIMEPERIOD_ID, string sFORECAST_TYPE, Int32 nOPP_COUNT, Int32 nOPP_WEIGH_VALUE, Int32 nCOMMIT_VALUE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORECASTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTIMEPERIOD_ID    = Sql.AddParameter(cmd, "@TIMEPERIOD_ID"   , gTIMEPERIOD_ID     );
							IDbDataParameter parFORECAST_TYPE    = Sql.AddParameter(cmd, "@FORECAST_TYPE"   , sFORECAST_TYPE     ,  25);
							IDbDataParameter parOPP_COUNT        = Sql.AddParameter(cmd, "@OPP_COUNT"       , nOPP_COUNT         );
							IDbDataParameter parOPP_WEIGH_VALUE  = Sql.AddParameter(cmd, "@OPP_WEIGH_VALUE" , nOPP_WEIGH_VALUE   );
							IDbDataParameter parCOMMIT_VALUE     = Sql.AddParameter(cmd, "@COMMIT_VALUE"    , nCOMMIT_VALUE      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORECASTS_Update
		/// <summary>
		/// spFORECASTS_Update
		/// </summary>
		public static void spFORECASTS_Update(ref Guid gID, Guid gTIMEPERIOD_ID, string sFORECAST_TYPE, Int32 nOPP_COUNT, Int32 nOPP_WEIGH_VALUE, Int32 nCOMMIT_VALUE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORECASTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTIMEPERIOD_ID    = Sql.AddParameter(cmd, "@TIMEPERIOD_ID"   , gTIMEPERIOD_ID     );
				IDbDataParameter parFORECAST_TYPE    = Sql.AddParameter(cmd, "@FORECAST_TYPE"   , sFORECAST_TYPE     ,  25);
				IDbDataParameter parOPP_COUNT        = Sql.AddParameter(cmd, "@OPP_COUNT"       , nOPP_COUNT         );
				IDbDataParameter parOPP_WEIGH_VALUE  = Sql.AddParameter(cmd, "@OPP_WEIGH_VALUE" , nOPP_WEIGH_VALUE   );
				IDbDataParameter parCOMMIT_VALUE     = Sql.AddParameter(cmd, "@COMMIT_VALUE"    , nCOMMIT_VALUE      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFORECASTS_Update
		/// <summary>
		/// spFORECASTS_Update
		/// </summary>
		public static IDbCommand cmdFORECASTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORECASTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTIMEPERIOD_ID    = Sql.CreateParameter(cmd, "@TIMEPERIOD_ID"   , "Guid",  16);
			IDbDataParameter parFORECAST_TYPE    = Sql.CreateParameter(cmd, "@FORECAST_TYPE"   , "string",  25);
			IDbDataParameter parOPP_COUNT        = Sql.CreateParameter(cmd, "@OPP_COUNT"       , "Int32",   4);
			IDbDataParameter parOPP_WEIGH_VALUE  = Sql.CreateParameter(cmd, "@OPP_WEIGH_VALUE" , "Int32",   4);
			IDbDataParameter parCOMMIT_VALUE     = Sql.CreateParameter(cmd, "@COMMIT_VALUE"    , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFORUM_TOPICS_Delete
		/// <summary>
		/// spFORUM_TOPICS_Delete
		/// </summary>
		public static void spFORUM_TOPICS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORUM_TOPICS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORUM_TOPICS_Delete
		/// <summary>
		/// spFORUM_TOPICS_Delete
		/// </summary>
		public static void spFORUM_TOPICS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORUM_TOPICS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORUM_TOPICS_Delete
		/// <summary>
		/// spFORUM_TOPICS_Delete
		/// </summary>
		public static IDbCommand cmdFORUM_TOPICS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORUM_TOPICS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFORUM_TOPICS_Update
		/// <summary>
		/// spFORUM_TOPICS_Update
		/// </summary>
		public static void spFORUM_TOPICS_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORUM_TOPICS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORUM_TOPICS_Update
		/// <summary>
		/// spFORUM_TOPICS_Update
		/// </summary>
		public static void spFORUM_TOPICS_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORUM_TOPICS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFORUM_TOPICS_Update
		/// <summary>
		/// spFORUM_TOPICS_Update
		/// </summary>
		public static IDbCommand cmdFORUM_TOPICS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORUM_TOPICS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFORUMS_Delete
		/// <summary>
		/// spFORUMS_Delete
		/// </summary>
		public static void spFORUMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORUMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORUMS_Delete
		/// <summary>
		/// spFORUMS_Delete
		/// </summary>
		public static void spFORUMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORUMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORUMS_Delete
		/// <summary>
		/// spFORUMS_Delete
		/// </summary>
		public static IDbCommand cmdFORUMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORUMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spFORUMS_Update
		/// <summary>
		/// spFORUMS_Update
		/// </summary>
		public static void spFORUMS_Update(ref Guid gID, string sTITLE, string sCATEGORY, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORUMS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 150);
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 150);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORUMS_Update
		/// <summary>
		/// spFORUMS_Update
		/// </summary>
		public static void spFORUMS_Update(ref Guid gID, string sTITLE, string sCATEGORY, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORUMS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 150);
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 150);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdFORUMS_Update
		/// <summary>
		/// spFORUMS_Update
		/// </summary>
		public static IDbCommand cmdFORUMS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORUMS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTITLE            = Sql.CreateParameter(cmd, "@TITLE"           , "string", 150);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string", 150);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spFORUMS_UpdateThreadCount
		/// <summary>
		/// spFORUMS_UpdateThreadCount
		/// </summary>
		public static void spFORUMS_UpdateThreadCount(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spFORUMS_UpdateThreadCount";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spFORUMS_UpdateThreadCount
		/// <summary>
		/// spFORUMS_UpdateThreadCount
		/// </summary>
		public static void spFORUMS_UpdateThreadCount(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spFORUMS_UpdateThreadCount";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdFORUMS_UpdateThreadCount
		/// <summary>
		/// spFORUMS_UpdateThreadCount
		/// </summary>
		public static IDbCommand cmdFORUMS_UpdateThreadCount(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spFORUMS_UpdateThreadCount";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_Delete
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Delete
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_COLUMNS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_Delete
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Delete
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_Delete
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Delete
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_COLUMNS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBound
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBound
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBound(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBound";
							IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
							IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
							IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
							IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
							IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBound
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBound
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBound(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBound";
				IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
				IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
				IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
				IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
				IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_InsBound
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBound
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_InsBound(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBound";
			IDbDataParameter parGRID_NAME       = Sql.CreateParameter(cmd, "@GRID_NAME"      , "string",  50);
			IDbDataParameter parCOLUMN_INDEX    = Sql.CreateParameter(cmd, "@COLUMN_INDEX"   , "Int32",   4);
			IDbDataParameter parHEADER_TEXT     = Sql.CreateParameter(cmd, "@HEADER_TEXT"    , "string", 150);
			IDbDataParameter parDATA_FIELD      = Sql.CreateParameter(cmd, "@DATA_FIELD"     , "string",  50);
			IDbDataParameter parSORT_EXPRESSION = Sql.CreateParameter(cmd, "@SORT_EXPRESSION", "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH", "string",  10);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBoundDate
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundDate
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBoundDate(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sDATA_FORMAT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDa";
							else
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDate";
							IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
							IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
							IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
							IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
							IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
							IDbDataParameter parDATA_FORMAT     = Sql.AddParameter(cmd, "@DATA_FORMAT"    , sDATA_FORMAT      ,  10);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBoundDate
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundDate
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBoundDate(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sDATA_FORMAT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDa";
				else
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDate";
				IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
				IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
				IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
				IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
				IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
				IDbDataParameter parDATA_FORMAT     = Sql.AddParameter(cmd, "@DATA_FORMAT"    , sDATA_FORMAT      ,  10);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_InsBoundDate
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundDate
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_InsBoundDate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDa";
			else
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundDate";
			IDbDataParameter parGRID_NAME       = Sql.CreateParameter(cmd, "@GRID_NAME"      , "string",  50);
			IDbDataParameter parCOLUMN_INDEX    = Sql.CreateParameter(cmd, "@COLUMN_INDEX"   , "Int32",   4);
			IDbDataParameter parHEADER_TEXT     = Sql.CreateParameter(cmd, "@HEADER_TEXT"    , "string", 150);
			IDbDataParameter parDATA_FIELD      = Sql.CreateParameter(cmd, "@DATA_FIELD"     , "string",  50);
			IDbDataParameter parSORT_EXPRESSION = Sql.CreateParameter(cmd, "@SORT_EXPRESSION", "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH", "string",  10);
			IDbDataParameter parDATA_FORMAT     = Sql.CreateParameter(cmd, "@DATA_FORMAT"    , "string",  10);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBoundList
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundList
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBoundList(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sLIST_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundLi";
							else
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundList";
							IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
							IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
							IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
							IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
							IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
							IDbDataParameter parLIST_NAME       = Sql.AddParameter(cmd, "@LIST_NAME"      , sLIST_NAME        ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsBoundList
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundList
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsBoundList(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sLIST_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundLi";
				else
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundList";
				IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
				IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
				IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
				IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
				IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
				IDbDataParameter parLIST_NAME       = Sql.AddParameter(cmd, "@LIST_NAME"      , sLIST_NAME        ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_InsBoundList
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsBoundList
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_InsBoundList(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundLi";
			else
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsBoundList";
			IDbDataParameter parGRID_NAME       = Sql.CreateParameter(cmd, "@GRID_NAME"      , "string",  50);
			IDbDataParameter parCOLUMN_INDEX    = Sql.CreateParameter(cmd, "@COLUMN_INDEX"   , "Int32",   4);
			IDbDataParameter parHEADER_TEXT     = Sql.CreateParameter(cmd, "@HEADER_TEXT"    , "string", 150);
			IDbDataParameter parDATA_FIELD      = Sql.CreateParameter(cmd, "@DATA_FIELD"     , "string",  50);
			IDbDataParameter parSORT_EXPRESSION = Sql.CreateParameter(cmd, "@SORT_EXPRESSION", "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH", "string",  10);
			IDbDataParameter parLIST_NAME       = Sql.CreateParameter(cmd, "@LIST_NAME"      , "string",  50);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsField
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsField
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsField(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsField";
							IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
							IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
							IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
							IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
							IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsField
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsField
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsField(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsField";
				IDbDataParameter parGRID_NAME       = Sql.AddParameter(cmd, "@GRID_NAME"      , sGRID_NAME        ,  50);
				IDbDataParameter parCOLUMN_INDEX    = Sql.AddParameter(cmd, "@COLUMN_INDEX"   , nCOLUMN_INDEX     );
				IDbDataParameter parHEADER_TEXT     = Sql.AddParameter(cmd, "@HEADER_TEXT"    , sHEADER_TEXT      , 150);
				IDbDataParameter parDATA_FIELD      = Sql.AddParameter(cmd, "@DATA_FIELD"     , sDATA_FIELD       ,  50);
				IDbDataParameter parSORT_EXPRESSION = Sql.AddParameter(cmd, "@SORT_EXPRESSION", sSORT_EXPRESSION  ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH", sITEMSTYLE_WIDTH  ,  10);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_InsField
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsField
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_InsField(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsField";
			IDbDataParameter parGRID_NAME       = Sql.CreateParameter(cmd, "@GRID_NAME"      , "string",  50);
			IDbDataParameter parCOLUMN_INDEX    = Sql.CreateParameter(cmd, "@COLUMN_INDEX"   , "Int32",   4);
			IDbDataParameter parHEADER_TEXT     = Sql.CreateParameter(cmd, "@HEADER_TEXT"    , "string", 150);
			IDbDataParameter parDATA_FIELD      = Sql.CreateParameter(cmd, "@DATA_FIELD"     , "string",  50);
			IDbDataParameter parSORT_EXPRESSION = Sql.CreateParameter(cmd, "@SORT_EXPRESSION", "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH", "string",  10);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsHyperLink
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsHyperLink
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsHyperLink(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sURL_MODULE, string sURL_ASSIGNED_FIELD)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLi";
							else
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLink";
							IDbDataParameter parGRID_NAME          = Sql.AddParameter(cmd, "@GRID_NAME"         , sGRID_NAME           ,  50);
							IDbDataParameter parCOLUMN_INDEX       = Sql.AddParameter(cmd, "@COLUMN_INDEX"      , nCOLUMN_INDEX        );
							IDbDataParameter parHEADER_TEXT        = Sql.AddParameter(cmd, "@HEADER_TEXT"       , sHEADER_TEXT         , 150);
							IDbDataParameter parDATA_FIELD         = Sql.AddParameter(cmd, "@DATA_FIELD"        , sDATA_FIELD          ,  50);
							IDbDataParameter parSORT_EXPRESSION    = Sql.AddParameter(cmd, "@SORT_EXPRESSION"   , sSORT_EXPRESSION     ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH    = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"   , sITEMSTYLE_WIDTH     ,  10);
							IDbDataParameter parITEMSTYLE_CSSCLASS = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS", sITEMSTYLE_CSSCLASS  ,  50);
							IDbDataParameter parURL_FIELD          = Sql.AddParameter(cmd, "@URL_FIELD"         , sURL_FIELD           ,  50);
							IDbDataParameter parURL_FORMAT         = Sql.AddParameter(cmd, "@URL_FORMAT"        , sURL_FORMAT          , 100);
							IDbDataParameter parURL_TARGET         = Sql.AddParameter(cmd, "@URL_TARGET"        , sURL_TARGET          ,  20);
							IDbDataParameter parURL_MODULE         = Sql.AddParameter(cmd, "@URL_MODULE"        , sURL_MODULE          ,  25);
							IDbDataParameter parURL_ASSIGNED_FIELD = Sql.AddParameter(cmd, "@URL_ASSIGNED_FIELD", sURL_ASSIGNED_FIELD  ,  30);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_InsHyperLink
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsHyperLink
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_InsHyperLink(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sHEADER_TEXT, string sDATA_FIELD, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sURL_MODULE, string sURL_ASSIGNED_FIELD, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLi";
				else
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLink";
				IDbDataParameter parGRID_NAME          = Sql.AddParameter(cmd, "@GRID_NAME"         , sGRID_NAME           ,  50);
				IDbDataParameter parCOLUMN_INDEX       = Sql.AddParameter(cmd, "@COLUMN_INDEX"      , nCOLUMN_INDEX        );
				IDbDataParameter parHEADER_TEXT        = Sql.AddParameter(cmd, "@HEADER_TEXT"       , sHEADER_TEXT         , 150);
				IDbDataParameter parDATA_FIELD         = Sql.AddParameter(cmd, "@DATA_FIELD"        , sDATA_FIELD          ,  50);
				IDbDataParameter parSORT_EXPRESSION    = Sql.AddParameter(cmd, "@SORT_EXPRESSION"   , sSORT_EXPRESSION     ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH    = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"   , sITEMSTYLE_WIDTH     ,  10);
				IDbDataParameter parITEMSTYLE_CSSCLASS = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS", sITEMSTYLE_CSSCLASS  ,  50);
				IDbDataParameter parURL_FIELD          = Sql.AddParameter(cmd, "@URL_FIELD"         , sURL_FIELD           ,  50);
				IDbDataParameter parURL_FORMAT         = Sql.AddParameter(cmd, "@URL_FORMAT"        , sURL_FORMAT          , 100);
				IDbDataParameter parURL_TARGET         = Sql.AddParameter(cmd, "@URL_TARGET"        , sURL_TARGET          ,  20);
				IDbDataParameter parURL_MODULE         = Sql.AddParameter(cmd, "@URL_MODULE"        , sURL_MODULE          ,  25);
				IDbDataParameter parURL_ASSIGNED_FIELD = Sql.AddParameter(cmd, "@URL_ASSIGNED_FIELD", sURL_ASSIGNED_FIELD  ,  30);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_InsHyperLink
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_InsHyperLink
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_InsHyperLink(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLi";
			else
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_InsHyperLink";
			IDbDataParameter parGRID_NAME          = Sql.CreateParameter(cmd, "@GRID_NAME"         , "string",  50);
			IDbDataParameter parCOLUMN_INDEX       = Sql.CreateParameter(cmd, "@COLUMN_INDEX"      , "Int32",   4);
			IDbDataParameter parHEADER_TEXT        = Sql.CreateParameter(cmd, "@HEADER_TEXT"       , "string", 150);
			IDbDataParameter parDATA_FIELD         = Sql.CreateParameter(cmd, "@DATA_FIELD"        , "string",  50);
			IDbDataParameter parSORT_EXPRESSION    = Sql.CreateParameter(cmd, "@SORT_EXPRESSION"   , "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH    = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH"   , "string",  10);
			IDbDataParameter parITEMSTYLE_CSSCLASS = Sql.CreateParameter(cmd, "@ITEMSTYLE_CSSCLASS", "string",  50);
			IDbDataParameter parURL_FIELD          = Sql.CreateParameter(cmd, "@URL_FIELD"         , "string",  50);
			IDbDataParameter parURL_FORMAT         = Sql.CreateParameter(cmd, "@URL_FORMAT"        , "string", 100);
			IDbDataParameter parURL_TARGET         = Sql.CreateParameter(cmd, "@URL_TARGET"        , "string",  20);
			IDbDataParameter parURL_MODULE         = Sql.CreateParameter(cmd, "@URL_MODULE"        , "string",  25);
			IDbDataParameter parURL_ASSIGNED_FIELD = Sql.CreateParameter(cmd, "@URL_ASSIGNED_FIELD", "string",  30);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_Update
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Update
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_Update(ref Guid gID, string sGRID_NAME, Int32 nCOLUMN_INDEX, string sCOLUMN_TYPE, string sHEADER_TEXT, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sITEMSTYLE_HORIZONTAL_ALIGN, string sITEMSTYLE_VERTICAL_ALIGN, bool bITEMSTYLE_WRAP, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, string sURL_MODULE, string sURL_ASSIGNED_FIELD)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_COLUMNS_Update";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parGRID_NAME                  = Sql.AddParameter(cmd, "@GRID_NAME"                 , sGRID_NAME                   ,  50);
							IDbDataParameter parCOLUMN_INDEX               = Sql.AddParameter(cmd, "@COLUMN_INDEX"              , nCOLUMN_INDEX                );
							IDbDataParameter parCOLUMN_TYPE                = Sql.AddParameter(cmd, "@COLUMN_TYPE"               , sCOLUMN_TYPE                 ,  25);
							IDbDataParameter parHEADER_TEXT                = Sql.AddParameter(cmd, "@HEADER_TEXT"               , sHEADER_TEXT                 , 150);
							IDbDataParameter parSORT_EXPRESSION            = Sql.AddParameter(cmd, "@SORT_EXPRESSION"           , sSORT_EXPRESSION             ,  50);
							IDbDataParameter parITEMSTYLE_WIDTH            = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"           , sITEMSTYLE_WIDTH             ,  10);
							IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , sITEMSTYLE_CSSCLASS          ,  50);
							IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.AddParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", sITEMSTYLE_HORIZONTAL_ALIGN  ,  10);
							IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.AddParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , sITEMSTYLE_VERTICAL_ALIGN    ,  10);
							IDbDataParameter parITEMSTYLE_WRAP             = Sql.AddParameter(cmd, "@ITEMSTYLE_WRAP"            , bITEMSTYLE_WRAP              );
							IDbDataParameter parDATA_FIELD                 = Sql.AddParameter(cmd, "@DATA_FIELD"                , sDATA_FIELD                  ,  50);
							IDbDataParameter parDATA_FORMAT                = Sql.AddParameter(cmd, "@DATA_FORMAT"               , sDATA_FORMAT                 ,  10);
							IDbDataParameter parURL_FIELD                  = Sql.AddParameter(cmd, "@URL_FIELD"                 , sURL_FIELD                   ,  50);
							IDbDataParameter parURL_FORMAT                 = Sql.AddParameter(cmd, "@URL_FORMAT"                , sURL_FORMAT                  , 100);
							IDbDataParameter parURL_TARGET                 = Sql.AddParameter(cmd, "@URL_TARGET"                , sURL_TARGET                  ,  20);
							IDbDataParameter parLIST_NAME                  = Sql.AddParameter(cmd, "@LIST_NAME"                 , sLIST_NAME                   ,  50);
							IDbDataParameter parURL_MODULE                 = Sql.AddParameter(cmd, "@URL_MODULE"                , sURL_MODULE                  ,  25);
							IDbDataParameter parURL_ASSIGNED_FIELD         = Sql.AddParameter(cmd, "@URL_ASSIGNED_FIELD"        , sURL_ASSIGNED_FIELD          ,  30);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_Update
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Update
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_Update(ref Guid gID, string sGRID_NAME, Int32 nCOLUMN_INDEX, string sCOLUMN_TYPE, string sHEADER_TEXT, string sSORT_EXPRESSION, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sITEMSTYLE_HORIZONTAL_ALIGN, string sITEMSTYLE_VERTICAL_ALIGN, bool bITEMSTYLE_WRAP, string sDATA_FIELD, string sDATA_FORMAT, string sURL_FIELD, string sURL_FORMAT, string sURL_TARGET, string sLIST_NAME, string sURL_MODULE, string sURL_ASSIGNED_FIELD, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_Update";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parGRID_NAME                  = Sql.AddParameter(cmd, "@GRID_NAME"                 , sGRID_NAME                   ,  50);
				IDbDataParameter parCOLUMN_INDEX               = Sql.AddParameter(cmd, "@COLUMN_INDEX"              , nCOLUMN_INDEX                );
				IDbDataParameter parCOLUMN_TYPE                = Sql.AddParameter(cmd, "@COLUMN_TYPE"               , sCOLUMN_TYPE                 ,  25);
				IDbDataParameter parHEADER_TEXT                = Sql.AddParameter(cmd, "@HEADER_TEXT"               , sHEADER_TEXT                 , 150);
				IDbDataParameter parSORT_EXPRESSION            = Sql.AddParameter(cmd, "@SORT_EXPRESSION"           , sSORT_EXPRESSION             ,  50);
				IDbDataParameter parITEMSTYLE_WIDTH            = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"           , sITEMSTYLE_WIDTH             ,  10);
				IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , sITEMSTYLE_CSSCLASS          ,  50);
				IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.AddParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", sITEMSTYLE_HORIZONTAL_ALIGN  ,  10);
				IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.AddParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , sITEMSTYLE_VERTICAL_ALIGN    ,  10);
				IDbDataParameter parITEMSTYLE_WRAP             = Sql.AddParameter(cmd, "@ITEMSTYLE_WRAP"            , bITEMSTYLE_WRAP              );
				IDbDataParameter parDATA_FIELD                 = Sql.AddParameter(cmd, "@DATA_FIELD"                , sDATA_FIELD                  ,  50);
				IDbDataParameter parDATA_FORMAT                = Sql.AddParameter(cmd, "@DATA_FORMAT"               , sDATA_FORMAT                 ,  10);
				IDbDataParameter parURL_FIELD                  = Sql.AddParameter(cmd, "@URL_FIELD"                 , sURL_FIELD                   ,  50);
				IDbDataParameter parURL_FORMAT                 = Sql.AddParameter(cmd, "@URL_FORMAT"                , sURL_FORMAT                  , 100);
				IDbDataParameter parURL_TARGET                 = Sql.AddParameter(cmd, "@URL_TARGET"                , sURL_TARGET                  ,  20);
				IDbDataParameter parLIST_NAME                  = Sql.AddParameter(cmd, "@LIST_NAME"                 , sLIST_NAME                   ,  50);
				IDbDataParameter parURL_MODULE                 = Sql.AddParameter(cmd, "@URL_MODULE"                , sURL_MODULE                  ,  25);
				IDbDataParameter parURL_ASSIGNED_FIELD         = Sql.AddParameter(cmd, "@URL_ASSIGNED_FIELD"        , sURL_ASSIGNED_FIELD          ,  30);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_Update
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_Update
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_COLUMNS_Update";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parGRID_NAME                  = Sql.CreateParameter(cmd, "@GRID_NAME"                 , "string",  50);
			IDbDataParameter parCOLUMN_INDEX               = Sql.CreateParameter(cmd, "@COLUMN_INDEX"              , "Int32",   4);
			IDbDataParameter parCOLUMN_TYPE                = Sql.CreateParameter(cmd, "@COLUMN_TYPE"               , "string",  25);
			IDbDataParameter parHEADER_TEXT                = Sql.CreateParameter(cmd, "@HEADER_TEXT"               , "string", 150);
			IDbDataParameter parSORT_EXPRESSION            = Sql.CreateParameter(cmd, "@SORT_EXPRESSION"           , "string",  50);
			IDbDataParameter parITEMSTYLE_WIDTH            = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH"           , "string",  10);
			IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.CreateParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , "string",  50);
			IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.CreateParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", "string",  10);
			IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.CreateParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , "string",  10);
			IDbDataParameter parITEMSTYLE_WRAP             = Sql.CreateParameter(cmd, "@ITEMSTYLE_WRAP"            , "bool",   1);
			IDbDataParameter parDATA_FIELD                 = Sql.CreateParameter(cmd, "@DATA_FIELD"                , "string",  50);
			IDbDataParameter parDATA_FORMAT                = Sql.CreateParameter(cmd, "@DATA_FORMAT"               , "string",  10);
			IDbDataParameter parURL_FIELD                  = Sql.CreateParameter(cmd, "@URL_FIELD"                 , "string",  50);
			IDbDataParameter parURL_FORMAT                 = Sql.CreateParameter(cmd, "@URL_FORMAT"                , "string", 100);
			IDbDataParameter parURL_TARGET                 = Sql.CreateParameter(cmd, "@URL_TARGET"                , "string",  20);
			IDbDataParameter parLIST_NAME                  = Sql.CreateParameter(cmd, "@LIST_NAME"                 , "string",  50);
			IDbDataParameter parURL_MODULE                 = Sql.CreateParameter(cmd, "@URL_MODULE"                , "string",  25);
			IDbDataParameter parURL_ASSIGNED_FIELD         = Sql.CreateParameter(cmd, "@URL_ASSIGNED_FIELD"        , "string",  30);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_UpdateStyle
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_UpdateStyle
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_UpdateStyle(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sITEMSTYLE_HORIZONTAL_ALIGN, string sITEMSTYLE_VERTICAL_ALIGN, bool bITEMSTYLE_WRAP)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyl";
							else
								cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyle";
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parGRID_NAME                  = Sql.AddParameter(cmd, "@GRID_NAME"                 , sGRID_NAME                   ,  50);
							IDbDataParameter parCOLUMN_INDEX               = Sql.AddParameter(cmd, "@COLUMN_INDEX"              , nCOLUMN_INDEX                );
							IDbDataParameter parITEMSTYLE_WIDTH            = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"           , sITEMSTYLE_WIDTH             ,  10);
							IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , sITEMSTYLE_CSSCLASS          ,  50);
							IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.AddParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", sITEMSTYLE_HORIZONTAL_ALIGN  ,  10);
							IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.AddParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , sITEMSTYLE_VERTICAL_ALIGN    ,  10);
							IDbDataParameter parITEMSTYLE_WRAP             = Sql.AddParameter(cmd, "@ITEMSTYLE_WRAP"            , bITEMSTYLE_WRAP              );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_COLUMNS_UpdateStyle
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_UpdateStyle
		/// </summary>
		public static void spGRIDVIEWS_COLUMNS_UpdateStyle(string sGRID_NAME, Int32 nCOLUMN_INDEX, string sITEMSTYLE_WIDTH, string sITEMSTYLE_CSSCLASS, string sITEMSTYLE_HORIZONTAL_ALIGN, string sITEMSTYLE_VERTICAL_ALIGN, bool bITEMSTYLE_WRAP, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyl";
				else
					cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyle";
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parGRID_NAME                  = Sql.AddParameter(cmd, "@GRID_NAME"                 , sGRID_NAME                   ,  50);
				IDbDataParameter parCOLUMN_INDEX               = Sql.AddParameter(cmd, "@COLUMN_INDEX"              , nCOLUMN_INDEX                );
				IDbDataParameter parITEMSTYLE_WIDTH            = Sql.AddParameter(cmd, "@ITEMSTYLE_WIDTH"           , sITEMSTYLE_WIDTH             ,  10);
				IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.AddParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , sITEMSTYLE_CSSCLASS          ,  50);
				IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.AddParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", sITEMSTYLE_HORIZONTAL_ALIGN  ,  10);
				IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.AddParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , sITEMSTYLE_VERTICAL_ALIGN    ,  10);
				IDbDataParameter parITEMSTYLE_WRAP             = Sql.AddParameter(cmd, "@ITEMSTYLE_WRAP"            , bITEMSTYLE_WRAP              );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_COLUMNS_UpdateStyle
		/// <summary>
		/// spGRIDVIEWS_COLUMNS_UpdateStyle
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_COLUMNS_UpdateStyle(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyl";
			else
				cmd.CommandText = "spGRIDVIEWS_COLUMNS_UpdateStyle";
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parGRID_NAME                  = Sql.CreateParameter(cmd, "@GRID_NAME"                 , "string",  50);
			IDbDataParameter parCOLUMN_INDEX               = Sql.CreateParameter(cmd, "@COLUMN_INDEX"              , "Int32",   4);
			IDbDataParameter parITEMSTYLE_WIDTH            = Sql.CreateParameter(cmd, "@ITEMSTYLE_WIDTH"           , "string",  10);
			IDbDataParameter parITEMSTYLE_CSSCLASS         = Sql.CreateParameter(cmd, "@ITEMSTYLE_CSSCLASS"        , "string",  50);
			IDbDataParameter parITEMSTYLE_HORIZONTAL_ALIGN = Sql.CreateParameter(cmd, "@ITEMSTYLE_HORIZONTAL_ALIGN", "string",  10);
			IDbDataParameter parITEMSTYLE_VERTICAL_ALIGN   = Sql.CreateParameter(cmd, "@ITEMSTYLE_VERTICAL_ALIGN"  , "string",  10);
			IDbDataParameter parITEMSTYLE_WRAP             = Sql.CreateParameter(cmd, "@ITEMSTYLE_WRAP"            , "bool",   1);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_Delete
		/// <summary>
		/// spGRIDVIEWS_Delete
		/// </summary>
		public static void spGRIDVIEWS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_Delete
		/// <summary>
		/// spGRIDVIEWS_Delete
		/// </summary>
		public static void spGRIDVIEWS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_Delete
		/// <summary>
		/// spGRIDVIEWS_Delete
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_InsertOnly
		/// <summary>
		/// spGRIDVIEWS_InsertOnly
		/// </summary>
		public static void spGRIDVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_InsertOnly";
							IDbDataParameter parNAME        = Sql.AddParameter(cmd, "@NAME"       , sNAME         ,  50);
							IDbDataParameter parMODULE_NAME = Sql.AddParameter(cmd, "@MODULE_NAME", sMODULE_NAME  ,  25);
							IDbDataParameter parVIEW_NAME   = Sql.AddParameter(cmd, "@VIEW_NAME"  , sVIEW_NAME    ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_InsertOnly
		/// <summary>
		/// spGRIDVIEWS_InsertOnly
		/// </summary>
		public static void spGRIDVIEWS_InsertOnly(string sNAME, string sMODULE_NAME, string sVIEW_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_InsertOnly";
				IDbDataParameter parNAME        = Sql.AddParameter(cmd, "@NAME"       , sNAME         ,  50);
				IDbDataParameter parMODULE_NAME = Sql.AddParameter(cmd, "@MODULE_NAME", sMODULE_NAME  ,  25);
				IDbDataParameter parVIEW_NAME   = Sql.AddParameter(cmd, "@VIEW_NAME"  , sVIEW_NAME    ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdGRIDVIEWS_InsertOnly
		/// <summary>
		/// spGRIDVIEWS_InsertOnly
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_InsertOnly";
			IDbDataParameter parNAME        = Sql.CreateParameter(cmd, "@NAME"       , "string",  50);
			IDbDataParameter parMODULE_NAME = Sql.CreateParameter(cmd, "@MODULE_NAME", "string",  25);
			IDbDataParameter parVIEW_NAME   = Sql.CreateParameter(cmd, "@VIEW_NAME"  , "string",  50);
			return cmd;
		}
		#endregion

		#region spGRIDVIEWS_Update
		/// <summary>
		/// spGRIDVIEWS_Update
		/// </summary>
		public static void spGRIDVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spGRIDVIEWS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spGRIDVIEWS_Update
		/// <summary>
		/// spGRIDVIEWS_Update
		/// </summary>
		public static void spGRIDVIEWS_Update(ref Guid gID, string sNAME, string sMODULE_NAME, string sVIEW_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spGRIDVIEWS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parVIEW_NAME        = Sql.AddParameter(cmd, "@VIEW_NAME"       , sVIEW_NAME         ,  50);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdGRIDVIEWS_Update
		/// <summary>
		/// spGRIDVIEWS_Update
		/// </summary>
		public static IDbCommand cmdGRIDVIEWS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spGRIDVIEWS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parVIEW_NAME        = Sql.CreateParameter(cmd, "@VIEW_NAME"       , "string",  50);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spIFRAMES_Delete
		/// <summary>
		/// spIFRAMES_Delete
		/// </summary>
		public static void spIFRAMES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIFRAMES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIFRAMES_Delete
		/// <summary>
		/// spIFRAMES_Delete
		/// </summary>
		public static void spIFRAMES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIFRAMES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdIFRAMES_Delete
		/// <summary>
		/// spIFRAMES_Delete
		/// </summary>
		public static IDbCommand cmdIFRAMES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIFRAMES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spIFRAMES_MassDelete
		/// <summary>
		/// spIFRAMES_MassDelete
		/// </summary>
		public static void spIFRAMES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIFRAMES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIFRAMES_MassDelete
		/// <summary>
		/// spIFRAMES_MassDelete
		/// </summary>
		public static void spIFRAMES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIFRAMES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdIFRAMES_MassDelete
		/// <summary>
		/// spIFRAMES_MassDelete
		/// </summary>
		public static IDbCommand cmdIFRAMES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIFRAMES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spIFRAMES_Update
		/// <summary>
		/// spIFRAMES_Update
		/// </summary>
		public static void spIFRAMES_Update(ref Guid gID, string sNAME, string sURL, string sTYPE, string sPLACEMENT, bool bSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIFRAMES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
							IDbDataParameter parPLACEMENT        = Sql.AddParameter(cmd, "@PLACEMENT"       , sPLACEMENT         , 255);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , bSTATUS            );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIFRAMES_Update
		/// <summary>
		/// spIFRAMES_Update
		/// </summary>
		public static void spIFRAMES_Update(ref Guid gID, string sNAME, string sURL, string sTYPE, string sPLACEMENT, bool bSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIFRAMES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              , 255);
				IDbDataParameter parPLACEMENT        = Sql.AddParameter(cmd, "@PLACEMENT"       , sPLACEMENT         , 255);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , bSTATUS            );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdIFRAMES_Update
		/// <summary>
		/// spIFRAMES_Update
		/// </summary>
		public static IDbCommand cmdIFRAMES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIFRAMES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parURL              = Sql.CreateParameter(cmd, "@URL"             , "string", 255);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string", 255);
			IDbDataParameter parPLACEMENT        = Sql.CreateParameter(cmd, "@PLACEMENT"       , "string", 255);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spIMAGE_InitPointer
		/// <summary>
		/// spIMAGE_InitPointer
		/// </summary>
		public static void spIMAGE_InitPointer(Guid gID, ref byte[] binFILE_POINTER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMAGE_InitPointer";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							parFILE_POINTER.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMAGE_InitPointer
		/// <summary>
		/// spIMAGE_InitPointer
		/// </summary>
		public static void spIMAGE_InitPointer(Guid gID, ref byte[] binFILE_POINTER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMAGE_InitPointer";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				parFILE_POINTER.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
			}
		}
		#endregion

		#region cmdIMAGE_InitPointer
		/// <summary>
		/// spIMAGE_InitPointer
		/// </summary>
		public static IDbCommand cmdIMAGE_InitPointer(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMAGE_InitPointer";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			parFILE_POINTER.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spIMAGE_ReadOffset
		/// <summary>
		/// spIMAGE_ReadOffset
		/// </summary>
		public static void spIMAGE_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMAGE_ReadOffset";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
							IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
							IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
							parBYTES.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							byBYTES = Sql.ToBinary(parBYTES.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMAGE_ReadOffset
		/// <summary>
		/// spIMAGE_ReadOffset
		/// </summary>
		public static void spIMAGE_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMAGE_ReadOffset";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
				IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
				IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
				parBYTES.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				byBYTES = Sql.ToBinary(parBYTES.Value);
			}
		}
		#endregion

		#region cmdIMAGE_ReadOffset
		/// <summary>
		/// spIMAGE_ReadOffset
		/// </summary>
		public static IDbCommand cmdIMAGE_ReadOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMAGE_ReadOffset";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parFILE_OFFSET = Sql.CreateParameter(cmd, "@FILE_OFFSET", "Int32",   4);
			IDbDataParameter parREAD_SIZE   = Sql.CreateParameter(cmd, "@READ_SIZE"  , "Int32",   4);
			IDbDataParameter parBYTES       = Sql.CreateParameter(cmd, "@BYTES"      , "byte[]",  16);
			parBYTES.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spIMAGE_WriteOffset
		/// <summary>
		/// spIMAGE_WriteOffset
		/// </summary>
		public static void spIMAGE_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMAGE_WriteOffset";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
							IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMAGE_WriteOffset
		/// <summary>
		/// spIMAGE_WriteOffset
		/// </summary>
		public static void spIMAGE_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMAGE_WriteOffset";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
				IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdIMAGE_WriteOffset
		/// <summary>
		/// spIMAGE_WriteOffset
		/// </summary>
		public static IDbCommand cmdIMAGE_WriteOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMAGE_WriteOffset";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_OFFSET      = Sql.CreateParameter(cmd, "@FILE_OFFSET"     , "Int32",   4);
			IDbDataParameter parBYTES            = Sql.CreateParameter(cmd, "@BYTES"           , "byte[]",  16);
			return cmd;
		}
		#endregion

		#region spIMAGES_Delete
		/// <summary>
		/// spIMAGES_Delete
		/// </summary>
		public static void spIMAGES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMAGES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMAGES_Delete
		/// <summary>
		/// spIMAGES_Delete
		/// </summary>
		public static void spIMAGES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMAGES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdIMAGES_Delete
		/// <summary>
		/// spIMAGES_Delete
		/// </summary>
		public static IDbCommand cmdIMAGES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMAGES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spIMAGES_Insert
		/// <summary>
		/// spIMAGES_Insert
		/// </summary>
		public static void spIMAGES_Insert(ref Guid gID, Guid gPARENT_ID, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMAGES_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
							IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
							IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMAGES_Insert
		/// <summary>
		/// spIMAGES_Insert
		/// </summary>
		public static void spIMAGES_Insert(ref Guid gID, Guid gPARENT_ID, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMAGES_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
				IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
				IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdIMAGES_Insert
		/// <summary>
		/// spIMAGES_Insert
		/// </summary>
		public static IDbCommand cmdIMAGES_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMAGES_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parFILENAME         = Sql.CreateParameter(cmd, "@FILENAME"        , "string", 255);
			IDbDataParameter parFILE_EXT         = Sql.CreateParameter(cmd, "@FILE_EXT"        , "string",  25);
			IDbDataParameter parFILE_MIME_TYPE   = Sql.CreateParameter(cmd, "@FILE_MIME_TYPE"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spIMPORT_MAPS_Delete
		/// <summary>
		/// spIMPORT_MAPS_Delete
		/// </summary>
		public static void spIMPORT_MAPS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMPORT_MAPS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMPORT_MAPS_Delete
		/// <summary>
		/// spIMPORT_MAPS_Delete
		/// </summary>
		public static void spIMPORT_MAPS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMPORT_MAPS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdIMPORT_MAPS_Delete
		/// <summary>
		/// spIMPORT_MAPS_Delete
		/// </summary>
		public static IDbCommand cmdIMPORT_MAPS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMPORT_MAPS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spIMPORT_MAPS_Update
		/// <summary>
		/// spIMPORT_MAPS_Update
		/// </summary>
		public static void spIMPORT_MAPS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSOURCE, string sMODULE, bool bHAS_HEADER, bool bIS_PUBLISHED, string sCONTENT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spIMPORT_MAPS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            ,  25);
							IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            ,  25);
							IDbDataParameter parHAS_HEADER       = Sql.AddParameter(cmd, "@HAS_HEADER"      , bHAS_HEADER        );
							IDbDataParameter parIS_PUBLISHED     = Sql.AddParameter(cmd, "@IS_PUBLISHED"    , bIS_PUBLISHED      );
							IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spIMPORT_MAPS_Update
		/// <summary>
		/// spIMPORT_MAPS_Update
		/// </summary>
		public static void spIMPORT_MAPS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSOURCE, string sMODULE, bool bHAS_HEADER, bool bIS_PUBLISHED, string sCONTENT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spIMPORT_MAPS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            ,  25);
				IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            ,  25);
				IDbDataParameter parHAS_HEADER       = Sql.AddParameter(cmd, "@HAS_HEADER"      , bHAS_HEADER        );
				IDbDataParameter parIS_PUBLISHED     = Sql.AddParameter(cmd, "@IS_PUBLISHED"    , bIS_PUBLISHED      );
				IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdIMPORT_MAPS_Update
		/// <summary>
		/// spIMPORT_MAPS_Update
		/// </summary>
		public static IDbCommand cmdIMPORT_MAPS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spIMPORT_MAPS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parSOURCE           = Sql.CreateParameter(cmd, "@SOURCE"          , "string",  25);
			IDbDataParameter parMODULE           = Sql.CreateParameter(cmd, "@MODULE"          , "string",  25);
			IDbDataParameter parHAS_HEADER       = Sql.CreateParameter(cmd, "@HAS_HEADER"      , "bool",   1);
			IDbDataParameter parIS_PUBLISHED     = Sql.CreateParameter(cmd, "@IS_PUBLISHED"    , "bool",   1);
			IDbDataParameter parCONTENT          = Sql.CreateParameter(cmd, "@CONTENT"         , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINBOUND_EMAIL_AUTOREPLY_Delete
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Delete
		/// </summary>
		public static void spINBOUND_EMAIL_AUTOREPLY_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Dele";
							else
								cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINBOUND_EMAIL_AUTOREPLY_Delete
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Delete
		/// </summary>
		public static void spINBOUND_EMAIL_AUTOREPLY_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Dele";
				else
					cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINBOUND_EMAIL_AUTOREPLY_Delete
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Delete
		/// </summary>
		public static IDbCommand cmdINBOUND_EMAIL_AUTOREPLY_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Dele";
			else
				cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINBOUND_EMAIL_AUTOREPLY_Update
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Update
		/// </summary>
		public static void spINBOUND_EMAIL_AUTOREPLY_Update(ref Guid gID, string sAUTOREPLIED_TO)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Upda";
							else
								cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parAUTOREPLIED_TO   = Sql.AddParameter(cmd, "@AUTOREPLIED_TO"  , sAUTOREPLIED_TO    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINBOUND_EMAIL_AUTOREPLY_Update
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Update
		/// </summary>
		public static void spINBOUND_EMAIL_AUTOREPLY_Update(ref Guid gID, string sAUTOREPLIED_TO, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Upda";
				else
					cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parAUTOREPLIED_TO   = Sql.AddParameter(cmd, "@AUTOREPLIED_TO"  , sAUTOREPLIED_TO    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINBOUND_EMAIL_AUTOREPLY_Update
		/// <summary>
		/// spINBOUND_EMAIL_AUTOREPLY_Update
		/// </summary>
		public static IDbCommand cmdINBOUND_EMAIL_AUTOREPLY_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Upda";
			else
				cmd.CommandText = "spINBOUND_EMAIL_AUTOREPLY_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parAUTOREPLIED_TO   = Sql.CreateParameter(cmd, "@AUTOREPLIED_TO"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINBOUND_EMAILS_Delete
		/// <summary>
		/// spINBOUND_EMAILS_Delete
		/// </summary>
		public static void spINBOUND_EMAILS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINBOUND_EMAILS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINBOUND_EMAILS_Delete
		/// <summary>
		/// spINBOUND_EMAILS_Delete
		/// </summary>
		public static void spINBOUND_EMAILS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINBOUND_EMAILS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINBOUND_EMAILS_Delete
		/// <summary>
		/// spINBOUND_EMAILS_Delete
		/// </summary>
		public static IDbCommand cmdINBOUND_EMAILS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINBOUND_EMAILS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINBOUND_EMAILS_Update
		/// <summary>
		/// spINBOUND_EMAILS_Update
		/// </summary>
		public static void spINBOUND_EMAILS_Update(ref Guid gID, string sNAME, string sSTATUS, string sSERVER_URL, string sEMAIL_USER, string sEMAIL_PASSWORD, Int32 nPORT, bool bMAILBOX_SSL, string sSERVICE, string sMAILBOX, bool bMARK_READ, bool bONLY_SINCE, string sMAILBOX_TYPE, Guid gTEMPLATE_ID, Guid gGROUP_ID, string sFROM_NAME, string sFROM_ADDR, string sFILTER_DOMAIN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINBOUND_EMAILS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parSERVER_URL       = Sql.AddParameter(cmd, "@SERVER_URL"      , sSERVER_URL        , 100);
							IDbDataParameter parEMAIL_USER       = Sql.AddParameter(cmd, "@EMAIL_USER"      , sEMAIL_USER        , 100);
							IDbDataParameter parEMAIL_PASSWORD   = Sql.AddParameter(cmd, "@EMAIL_PASSWORD"  , sEMAIL_PASSWORD    , 100);
							IDbDataParameter parPORT             = Sql.AddParameter(cmd, "@PORT"            , nPORT              );
							IDbDataParameter parMAILBOX_SSL      = Sql.AddParameter(cmd, "@MAILBOX_SSL"     , bMAILBOX_SSL       );
							IDbDataParameter parSERVICE          = Sql.AddParameter(cmd, "@SERVICE"         , sSERVICE           ,  50);
							IDbDataParameter parMAILBOX          = Sql.AddParameter(cmd, "@MAILBOX"         , sMAILBOX           ,  50);
							IDbDataParameter parMARK_READ        = Sql.AddParameter(cmd, "@MARK_READ"       , bMARK_READ         );
							IDbDataParameter parONLY_SINCE       = Sql.AddParameter(cmd, "@ONLY_SINCE"      , bONLY_SINCE        );
							IDbDataParameter parMAILBOX_TYPE     = Sql.AddParameter(cmd, "@MAILBOX_TYPE"    , sMAILBOX_TYPE      ,  10);
							IDbDataParameter parTEMPLATE_ID      = Sql.AddParameter(cmd, "@TEMPLATE_ID"     , gTEMPLATE_ID       );
							IDbDataParameter parGROUP_ID         = Sql.AddParameter(cmd, "@GROUP_ID"        , gGROUP_ID          );
							IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
							IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
							IDbDataParameter parFILTER_DOMAIN    = Sql.AddParameter(cmd, "@FILTER_DOMAIN"   , sFILTER_DOMAIN     , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINBOUND_EMAILS_Update
		/// <summary>
		/// spINBOUND_EMAILS_Update
		/// </summary>
		public static void spINBOUND_EMAILS_Update(ref Guid gID, string sNAME, string sSTATUS, string sSERVER_URL, string sEMAIL_USER, string sEMAIL_PASSWORD, Int32 nPORT, bool bMAILBOX_SSL, string sSERVICE, string sMAILBOX, bool bMARK_READ, bool bONLY_SINCE, string sMAILBOX_TYPE, Guid gTEMPLATE_ID, Guid gGROUP_ID, string sFROM_NAME, string sFROM_ADDR, string sFILTER_DOMAIN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINBOUND_EMAILS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parSERVER_URL       = Sql.AddParameter(cmd, "@SERVER_URL"      , sSERVER_URL        , 100);
				IDbDataParameter parEMAIL_USER       = Sql.AddParameter(cmd, "@EMAIL_USER"      , sEMAIL_USER        , 100);
				IDbDataParameter parEMAIL_PASSWORD   = Sql.AddParameter(cmd, "@EMAIL_PASSWORD"  , sEMAIL_PASSWORD    , 100);
				IDbDataParameter parPORT             = Sql.AddParameter(cmd, "@PORT"            , nPORT              );
				IDbDataParameter parMAILBOX_SSL      = Sql.AddParameter(cmd, "@MAILBOX_SSL"     , bMAILBOX_SSL       );
				IDbDataParameter parSERVICE          = Sql.AddParameter(cmd, "@SERVICE"         , sSERVICE           ,  50);
				IDbDataParameter parMAILBOX          = Sql.AddParameter(cmd, "@MAILBOX"         , sMAILBOX           ,  50);
				IDbDataParameter parMARK_READ        = Sql.AddParameter(cmd, "@MARK_READ"       , bMARK_READ         );
				IDbDataParameter parONLY_SINCE       = Sql.AddParameter(cmd, "@ONLY_SINCE"      , bONLY_SINCE        );
				IDbDataParameter parMAILBOX_TYPE     = Sql.AddParameter(cmd, "@MAILBOX_TYPE"    , sMAILBOX_TYPE      ,  10);
				IDbDataParameter parTEMPLATE_ID      = Sql.AddParameter(cmd, "@TEMPLATE_ID"     , gTEMPLATE_ID       );
				IDbDataParameter parGROUP_ID         = Sql.AddParameter(cmd, "@GROUP_ID"        , gGROUP_ID          );
				IDbDataParameter parFROM_NAME        = Sql.AddParameter(cmd, "@FROM_NAME"       , sFROM_NAME         , 100);
				IDbDataParameter parFROM_ADDR        = Sql.AddParameter(cmd, "@FROM_ADDR"       , sFROM_ADDR         , 100);
				IDbDataParameter parFILTER_DOMAIN    = Sql.AddParameter(cmd, "@FILTER_DOMAIN"   , sFILTER_DOMAIN     , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINBOUND_EMAILS_Update
		/// <summary>
		/// spINBOUND_EMAILS_Update
		/// </summary>
		public static IDbCommand cmdINBOUND_EMAILS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINBOUND_EMAILS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parSERVER_URL       = Sql.CreateParameter(cmd, "@SERVER_URL"      , "string", 100);
			IDbDataParameter parEMAIL_USER       = Sql.CreateParameter(cmd, "@EMAIL_USER"      , "string", 100);
			IDbDataParameter parEMAIL_PASSWORD   = Sql.CreateParameter(cmd, "@EMAIL_PASSWORD"  , "string", 100);
			IDbDataParameter parPORT             = Sql.CreateParameter(cmd, "@PORT"            , "Int32",   4);
			IDbDataParameter parMAILBOX_SSL      = Sql.CreateParameter(cmd, "@MAILBOX_SSL"     , "bool",   1);
			IDbDataParameter parSERVICE          = Sql.CreateParameter(cmd, "@SERVICE"         , "string",  50);
			IDbDataParameter parMAILBOX          = Sql.CreateParameter(cmd, "@MAILBOX"         , "string",  50);
			IDbDataParameter parMARK_READ        = Sql.CreateParameter(cmd, "@MARK_READ"       , "bool",   1);
			IDbDataParameter parONLY_SINCE       = Sql.CreateParameter(cmd, "@ONLY_SINCE"      , "bool",   1);
			IDbDataParameter parMAILBOX_TYPE     = Sql.CreateParameter(cmd, "@MAILBOX_TYPE"    , "string",  10);
			IDbDataParameter parTEMPLATE_ID      = Sql.CreateParameter(cmd, "@TEMPLATE_ID"     , "Guid",  16);
			IDbDataParameter parGROUP_ID         = Sql.CreateParameter(cmd, "@GROUP_ID"        , "Guid",  16);
			IDbDataParameter parFROM_NAME        = Sql.CreateParameter(cmd, "@FROM_NAME"       , "string", 100);
			IDbDataParameter parFROM_ADDR        = Sql.CreateParameter(cmd, "@FROM_ADDR"       , "string", 100);
			IDbDataParameter parFILTER_DOMAIN    = Sql.CreateParameter(cmd, "@FILTER_DOMAIN"   , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINVOICES_ACCOUNTS_Update
		/// <summary>
		/// spINVOICES_ACCOUNTS_Update
		/// </summary>
		public static void spINVOICES_ACCOUNTS_Update(Guid gINVOICE_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_ACCOUNTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_ACCOUNTS_Update
		/// <summary>
		/// spINVOICES_ACCOUNTS_Update
		/// </summary>
		public static void spINVOICES_ACCOUNTS_Update(Guid gINVOICE_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_ACCOUNTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_ACCOUNTS_Update
		/// <summary>
		/// spINVOICES_ACCOUNTS_Update
		/// </summary>
		public static IDbCommand cmdINVOICES_ACCOUNTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_ACCOUNTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parINVOICE_ID       = Sql.CreateParameter(cmd, "@INVOICE_ID"      , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parACCOUNT_ROLE     = Sql.CreateParameter(cmd, "@ACCOUNT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spINVOICES_CONTACTS_Update
		/// <summary>
		/// spINVOICES_CONTACTS_Update
		/// </summary>
		public static void spINVOICES_CONTACTS_Update(Guid gINVOICE_ID, Guid gCONTACT_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_CONTACTS_Update
		/// <summary>
		/// spINVOICES_CONTACTS_Update
		/// </summary>
		public static void spINVOICES_CONTACTS_Update(Guid gINVOICE_ID, Guid gCONTACT_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_CONTACTS_Update
		/// <summary>
		/// spINVOICES_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdINVOICES_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parINVOICE_ID       = Sql.CreateParameter(cmd, "@INVOICE_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spINVOICES_ConvertOrder
		/// <summary>
		/// spINVOICES_ConvertOrder
		/// </summary>
		public static void spINVOICES_ConvertOrder(ref Guid gID, Guid gORDER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_ConvertOrder";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_ConvertOrder
		/// <summary>
		/// spINVOICES_ConvertOrder
		/// </summary>
		public static void spINVOICES_ConvertOrder(ref Guid gID, Guid gORDER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_ConvertOrder";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINVOICES_ConvertOrder
		/// <summary>
		/// spINVOICES_ConvertOrder
		/// </summary>
		public static IDbCommand cmdINVOICES_ConvertOrder(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_ConvertOrder";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINVOICES_Delete
		/// <summary>
		/// spINVOICES_Delete
		/// </summary>
		public static void spINVOICES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_Delete
		/// <summary>
		/// spINVOICES_Delete
		/// </summary>
		public static void spINVOICES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_Delete
		/// <summary>
		/// spINVOICES_Delete
		/// </summary>
		public static IDbCommand cmdINVOICES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINVOICES_LINE_ITEMS_Delete
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Delete
		/// </summary>
		public static void spINVOICES_LINE_ITEMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_LINE_ITEMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_LINE_ITEMS_Delete
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Delete
		/// </summary>
		public static void spINVOICES_LINE_ITEMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_LINE_ITEMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_LINE_ITEMS_Delete
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Delete
		/// </summary>
		public static IDbCommand cmdINVOICES_LINE_ITEMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_LINE_ITEMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINVOICES_LINE_ITEMS_Update
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Update
		/// </summary>
		public static void spINVOICES_LINE_ITEMS_Update(ref Guid gID, Guid gINVOICE_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_LINE_ITEMS_Update";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parINVOICE_ID          = Sql.AddParameter(cmd, "@INVOICE_ID"         , gINVOICE_ID           );
							IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
							IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
							IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
							IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
							IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
							IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
							IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
							IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
							IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
							IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
							IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
							IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_LINE_ITEMS_Update
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Update
		/// </summary>
		public static void spINVOICES_LINE_ITEMS_Update(ref Guid gID, Guid gINVOICE_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_LINE_ITEMS_Update";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parINVOICE_ID          = Sql.AddParameter(cmd, "@INVOICE_ID"         , gINVOICE_ID           );
				IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
				IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
				IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
				IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
				IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
				IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
				IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
				IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
				IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
				IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
				IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
				IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINVOICES_LINE_ITEMS_Update
		/// <summary>
		/// spINVOICES_LINE_ITEMS_Update
		/// </summary>
		public static IDbCommand cmdINVOICES_LINE_ITEMS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_LINE_ITEMS_Update";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parINVOICE_ID          = Sql.CreateParameter(cmd, "@INVOICE_ID"         , "Guid",  16);
			IDbDataParameter parLINE_GROUP_ID       = Sql.CreateParameter(cmd, "@LINE_GROUP_ID"      , "Guid",  16);
			IDbDataParameter parLINE_ITEM_TYPE      = Sql.CreateParameter(cmd, "@LINE_ITEM_TYPE"     , "string",  25);
			IDbDataParameter parPOSITION            = Sql.CreateParameter(cmd, "@POSITION"           , "Int32",   4);
			IDbDataParameter parNAME                = Sql.CreateParameter(cmd, "@NAME"               , "string", 100);
			IDbDataParameter parMFT_PART_NUM        = Sql.CreateParameter(cmd, "@MFT_PART_NUM"       , "string",  50);
			IDbDataParameter parVENDOR_PART_NUM     = Sql.CreateParameter(cmd, "@VENDOR_PART_NUM"    , "string",  50);
			IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.CreateParameter(cmd, "@PRODUCT_TEMPLATE_ID", "Guid",  16);
			IDbDataParameter parTAX_CLASS           = Sql.CreateParameter(cmd, "@TAX_CLASS"          , "string",  25);
			IDbDataParameter parQUANTITY            = Sql.CreateParameter(cmd, "@QUANTITY"           , "Int32",   4);
			IDbDataParameter parCOST_PRICE          = Sql.CreateParameter(cmd, "@COST_PRICE"         , "decimal",   8);
			IDbDataParameter parLIST_PRICE          = Sql.CreateParameter(cmd, "@LIST_PRICE"         , "decimal",   8);
			IDbDataParameter parUNIT_PRICE          = Sql.CreateParameter(cmd, "@UNIT_PRICE"         , "decimal",   8);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINVOICES_MassDelete
		/// <summary>
		/// spINVOICES_MassDelete
		/// </summary>
		public static void spINVOICES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_MassDelete
		/// <summary>
		/// spINVOICES_MassDelete
		/// </summary>
		public static void spINVOICES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_MassDelete
		/// <summary>
		/// spINVOICES_MassDelete
		/// </summary>
		public static IDbCommand cmdINVOICES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINVOICES_MassUpdate
		/// <summary>
		/// spINVOICES_MassUpdate
		/// </summary>
		public static void spINVOICES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sINVOICE_STAGE, DateTime dtDUE_DATE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parPAYMENT_TERMS    = Sql.AddParameter(cmd, "@PAYMENT_TERMS"   , sPAYMENT_TERMS     ,  25);
							IDbDataParameter parINVOICE_STAGE    = Sql.AddParameter(cmd, "@INVOICE_STAGE"   , sINVOICE_STAGE     ,  25);
							IDbDataParameter parDUE_DATE         = Sql.AddParameter(cmd, "@DUE_DATE"        , dtDUE_DATE         );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_MassUpdate
		/// <summary>
		/// spINVOICES_MassUpdate
		/// </summary>
		public static void spINVOICES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sINVOICE_STAGE, DateTime dtDUE_DATE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parPAYMENT_TERMS    = Sql.AddParameter(cmd, "@PAYMENT_TERMS"   , sPAYMENT_TERMS     ,  25);
				IDbDataParameter parINVOICE_STAGE    = Sql.AddParameter(cmd, "@INVOICE_STAGE"   , sINVOICE_STAGE     ,  25);
				IDbDataParameter parDUE_DATE         = Sql.AddParameter(cmd, "@DUE_DATE"        , dtDUE_DATE         );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_MassUpdate
		/// <summary>
		/// spINVOICES_MassUpdate
		/// </summary>
		public static IDbCommand cmdINVOICES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parPAYMENT_TERMS    = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"   , "string",  25);
			IDbDataParameter parINVOICE_STAGE    = Sql.CreateParameter(cmd, "@INVOICE_STAGE"   , "string",  25);
			IDbDataParameter parDUE_DATE         = Sql.CreateParameter(cmd, "@DUE_DATE"        , "DateTime",   8);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINVOICES_PAYMENTS_Delete
		/// <summary>
		/// spINVOICES_PAYMENTS_Delete
		/// </summary>
		public static void spINVOICES_PAYMENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_PAYMENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_PAYMENTS_Delete
		/// <summary>
		/// spINVOICES_PAYMENTS_Delete
		/// </summary>
		public static void spINVOICES_PAYMENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_PAYMENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_PAYMENTS_Delete
		/// <summary>
		/// spINVOICES_PAYMENTS_Delete
		/// </summary>
		public static IDbCommand cmdINVOICES_PAYMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_PAYMENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spINVOICES_PAYMENTS_Update
		/// <summary>
		/// spINVOICES_PAYMENTS_Update
		/// </summary>
		public static void spINVOICES_PAYMENTS_Update(ref Guid gID, Guid gINVOICE_ID, Guid gPAYMENT_ID, decimal dAMOUNT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_PAYMENTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
							IDbDataParameter parPAYMENT_ID       = Sql.AddParameter(cmd, "@PAYMENT_ID"      , gPAYMENT_ID        );
							IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_PAYMENTS_Update
		/// <summary>
		/// spINVOICES_PAYMENTS_Update
		/// </summary>
		public static void spINVOICES_PAYMENTS_Update(ref Guid gID, Guid gINVOICE_ID, Guid gPAYMENT_ID, decimal dAMOUNT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_PAYMENTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parINVOICE_ID       = Sql.AddParameter(cmd, "@INVOICE_ID"      , gINVOICE_ID        );
				IDbDataParameter parPAYMENT_ID       = Sql.AddParameter(cmd, "@PAYMENT_ID"      , gPAYMENT_ID        );
				IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINVOICES_PAYMENTS_Update
		/// <summary>
		/// spINVOICES_PAYMENTS_Update
		/// </summary>
		public static IDbCommand cmdINVOICES_PAYMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_PAYMENTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parINVOICE_ID       = Sql.CreateParameter(cmd, "@INVOICE_ID"      , "Guid",  16);
			IDbDataParameter parPAYMENT_ID       = Sql.CreateParameter(cmd, "@PAYMENT_ID"      , "Guid",  16);
			IDbDataParameter parAMOUNT           = Sql.CreateParameter(cmd, "@AMOUNT"          , "decimal",   8);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINVOICES_Update
		/// <summary>
		/// spINVOICES_Update
		/// </summary>
		public static void spINVOICES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gQUOTE_ID, Guid gORDER_ID, Guid gOPPORTUNITY_ID, string sPAYMENT_TERMS, string sINVOICE_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtDUE_DATE, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, decimal dAMOUNT_DUE, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_Update";
							IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
							IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
							IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
							IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         , 100);
							IDbDataParameter parQUOTE_ID                    = Sql.AddParameter(cmd, "@QUOTE_ID"                   , gQUOTE_ID                     );
							IDbDataParameter parORDER_ID                    = Sql.AddParameter(cmd, "@ORDER_ID"                   , gORDER_ID                     );
							IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
							IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
							IDbDataParameter parINVOICE_STAGE               = Sql.AddParameter(cmd, "@INVOICE_STAGE"              , sINVOICE_STAGE                ,  25);
							IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
							IDbDataParameter parDUE_DATE                    = Sql.AddParameter(cmd, "@DUE_DATE"                   , dtDUE_DATE                    );
							IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
							IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
							IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
							IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
							IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
							IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
							IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
							IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
							IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
							IDbDataParameter parAMOUNT_DUE                  = Sql.AddParameter(cmd, "@AMOUNT_DUE"                 , dAMOUNT_DUE                   );
							IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
							IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
							IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
							IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
							IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
							IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
							IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
							IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
							IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
							IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
							IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
							IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
							IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
							IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_Update
		/// <summary>
		/// spINVOICES_Update
		/// </summary>
		public static void spINVOICES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gQUOTE_ID, Guid gORDER_ID, Guid gOPPORTUNITY_ID, string sPAYMENT_TERMS, string sINVOICE_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtDUE_DATE, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, decimal dAMOUNT_DUE, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_Update";
				IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
				IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
				IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
				IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         , 100);
				IDbDataParameter parQUOTE_ID                    = Sql.AddParameter(cmd, "@QUOTE_ID"                   , gQUOTE_ID                     );
				IDbDataParameter parORDER_ID                    = Sql.AddParameter(cmd, "@ORDER_ID"                   , gORDER_ID                     );
				IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
				IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
				IDbDataParameter parINVOICE_STAGE               = Sql.AddParameter(cmd, "@INVOICE_STAGE"              , sINVOICE_STAGE                ,  25);
				IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
				IDbDataParameter parDUE_DATE                    = Sql.AddParameter(cmd, "@DUE_DATE"                   , dtDUE_DATE                    );
				IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
				IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
				IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
				IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
				IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
				IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
				IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
				IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
				IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
				IDbDataParameter parAMOUNT_DUE                  = Sql.AddParameter(cmd, "@AMOUNT_DUE"                 , dAMOUNT_DUE                   );
				IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
				IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
				IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
				IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
				IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
				IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
				IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
				IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
				IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
				IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
				IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
				IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
				IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
				IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdINVOICES_Update
		/// <summary>
		/// spINVOICES_Update
		/// </summary>
		public static IDbCommand cmdINVOICES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_Update";
			IDbDataParameter parID                          = Sql.CreateParameter(cmd, "@ID"                         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID            = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"           , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID            = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"           , "Guid",  16);
			IDbDataParameter parNAME                        = Sql.CreateParameter(cmd, "@NAME"                       , "string", 100);
			IDbDataParameter parQUOTE_ID                    = Sql.CreateParameter(cmd, "@QUOTE_ID"                   , "Guid",  16);
			IDbDataParameter parORDER_ID                    = Sql.CreateParameter(cmd, "@ORDER_ID"                   , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID              = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"             , "Guid",  16);
			IDbDataParameter parPAYMENT_TERMS               = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"              , "string",  25);
			IDbDataParameter parINVOICE_STAGE               = Sql.CreateParameter(cmd, "@INVOICE_STAGE"              , "string",  25);
			IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.CreateParameter(cmd, "@PURCHASE_ORDER_NUM"         , "string",  50);
			IDbDataParameter parDUE_DATE                    = Sql.CreateParameter(cmd, "@DUE_DATE"                   , "DateTime",   8);
			IDbDataParameter parEXCHANGE_RATE               = Sql.CreateParameter(cmd, "@EXCHANGE_RATE"              , "float",   8);
			IDbDataParameter parCURRENCY_ID                 = Sql.CreateParameter(cmd, "@CURRENCY_ID"                , "Guid",  16);
			IDbDataParameter parTAXRATE_ID                  = Sql.CreateParameter(cmd, "@TAXRATE_ID"                 , "Guid",  16);
			IDbDataParameter parSHIPPER_ID                  = Sql.CreateParameter(cmd, "@SHIPPER_ID"                 , "Guid",  16);
			IDbDataParameter parSUBTOTAL                    = Sql.CreateParameter(cmd, "@SUBTOTAL"                   , "decimal",   8);
			IDbDataParameter parDISCOUNT                    = Sql.CreateParameter(cmd, "@DISCOUNT"                   , "decimal",   8);
			IDbDataParameter parSHIPPING                    = Sql.CreateParameter(cmd, "@SHIPPING"                   , "decimal",   8);
			IDbDataParameter parTAX                         = Sql.CreateParameter(cmd, "@TAX"                        , "decimal",   8);
			IDbDataParameter parTOTAL                       = Sql.CreateParameter(cmd, "@TOTAL"                      , "decimal",   8);
			IDbDataParameter parAMOUNT_DUE                  = Sql.CreateParameter(cmd, "@AMOUNT_DUE"                 , "decimal",   8);
			IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.CreateParameter(cmd, "@BILLING_ACCOUNT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_CONTACT_ID          = Sql.CreateParameter(cmd, "@BILLING_CONTACT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STREET"     , "string", 150);
			IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_CITY"       , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STATE"      , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , "string",  20);
			IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , "string", 100);
			IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_CONTACT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parDESCRIPTION                 = Sql.CreateParameter(cmd, "@DESCRIPTION"                , "string", 104857600);
			IDbDataParameter parTEAM_ID                     = Sql.CreateParameter(cmd, "@TEAM_ID"                    , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spINVOICES_UpdateTotals
		/// <summary>
		/// spINVOICES_UpdateTotals
		/// </summary>
		public static void spINVOICES_UpdateTotals(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spINVOICES_UpdateTotals";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spINVOICES_UpdateTotals
		/// <summary>
		/// spINVOICES_UpdateTotals
		/// </summary>
		public static void spINVOICES_UpdateTotals(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spINVOICES_UpdateTotals";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdINVOICES_UpdateTotals
		/// <summary>
		/// spINVOICES_UpdateTotals
		/// </summary>
		public static IDbCommand cmdINVOICES_UpdateTotals(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spINVOICES_UpdateTotals";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLANGUAGES_Delete
		/// <summary>
		/// spLANGUAGES_Delete
		/// </summary>
		public static void spLANGUAGES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLANGUAGES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLANGUAGES_Delete
		/// <summary>
		/// spLANGUAGES_Delete
		/// </summary>
		public static void spLANGUAGES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLANGUAGES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLANGUAGES_Delete
		/// <summary>
		/// spLANGUAGES_Delete
		/// </summary>
		public static IDbCommand cmdLANGUAGES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLANGUAGES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLANGUAGES_InsertOnly
		/// <summary>
		/// spLANGUAGES_InsertOnly
		/// </summary>
		public static void spLANGUAGES_InsertOnly(string sNAME, Int32 nLCID, bool bACTIVE, string sNATIVE_NAME, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLANGUAGES_InsertOnly";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  10);
							IDbDataParameter parLCID         = Sql.AddParameter(cmd, "@LCID"        , nLCID          );
							IDbDataParameter parACTIVE       = Sql.AddParameter(cmd, "@ACTIVE"      , bACTIVE        );
							IDbDataParameter parNATIVE_NAME  = Sql.AddParameter(cmd, "@NATIVE_NAME" , sNATIVE_NAME   ,  80);
							IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  ,  80);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLANGUAGES_InsertOnly
		/// <summary>
		/// spLANGUAGES_InsertOnly
		/// </summary>
		public static void spLANGUAGES_InsertOnly(string sNAME, Int32 nLCID, bool bACTIVE, string sNATIVE_NAME, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLANGUAGES_InsertOnly";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  10);
				IDbDataParameter parLCID         = Sql.AddParameter(cmd, "@LCID"        , nLCID          );
				IDbDataParameter parACTIVE       = Sql.AddParameter(cmd, "@ACTIVE"      , bACTIVE        );
				IDbDataParameter parNATIVE_NAME  = Sql.AddParameter(cmd, "@NATIVE_NAME" , sNATIVE_NAME   ,  80);
				IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  ,  80);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLANGUAGES_InsertOnly
		/// <summary>
		/// spLANGUAGES_InsertOnly
		/// </summary>
		public static IDbCommand cmdLANGUAGES_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLANGUAGES_InsertOnly";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  10);
			IDbDataParameter parLCID         = Sql.CreateParameter(cmd, "@LCID"        , "Int32",   4);
			IDbDataParameter parACTIVE       = Sql.CreateParameter(cmd, "@ACTIVE"      , "bool",   1);
			IDbDataParameter parNATIVE_NAME  = Sql.CreateParameter(cmd, "@NATIVE_NAME" , "string",  80);
			IDbDataParameter parDISPLAY_NAME = Sql.CreateParameter(cmd, "@DISPLAY_NAME", "string",  80);
			return cmd;
		}
		#endregion

		#region spLANGUAGES_Update
		/// <summary>
		/// spLANGUAGES_Update
		/// </summary>
		public static void spLANGUAGES_Update(ref Guid gID, string sNAME, Int32 nLCID, bool bACTIVE, string sNATIVE_NAME, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLANGUAGES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  10);
							IDbDataParameter parLCID             = Sql.AddParameter(cmd, "@LCID"            , nLCID              );
							IDbDataParameter parACTIVE           = Sql.AddParameter(cmd, "@ACTIVE"          , bACTIVE            );
							IDbDataParameter parNATIVE_NAME      = Sql.AddParameter(cmd, "@NATIVE_NAME"     , sNATIVE_NAME       ,  80);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  80);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLANGUAGES_Update
		/// <summary>
		/// spLANGUAGES_Update
		/// </summary>
		public static void spLANGUAGES_Update(ref Guid gID, string sNAME, Int32 nLCID, bool bACTIVE, string sNATIVE_NAME, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLANGUAGES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  10);
				IDbDataParameter parLCID             = Sql.AddParameter(cmd, "@LCID"            , nLCID              );
				IDbDataParameter parACTIVE           = Sql.AddParameter(cmd, "@ACTIVE"          , bACTIVE            );
				IDbDataParameter parNATIVE_NAME      = Sql.AddParameter(cmd, "@NATIVE_NAME"     , sNATIVE_NAME       ,  80);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  80);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdLANGUAGES_Update
		/// <summary>
		/// spLANGUAGES_Update
		/// </summary>
		public static IDbCommand cmdLANGUAGES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLANGUAGES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  10);
			IDbDataParameter parLCID             = Sql.CreateParameter(cmd, "@LCID"            , "Int32",   4);
			IDbDataParameter parACTIVE           = Sql.CreateParameter(cmd, "@ACTIVE"          , "bool",   1);
			IDbDataParameter parNATIVE_NAME      = Sql.CreateParameter(cmd, "@NATIVE_NAME"     , "string",  80);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string",  80);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spLEADS_ConvertProspect
		/// <summary>
		/// spLEADS_ConvertProspect
		/// </summary>
		public static void spLEADS_ConvertProspect(ref Guid gID, Guid gPROSPECT_ID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sREFERED_BY, string sLEAD_SOURCE, string sLEAD_SOURCE_DESCRIPTION, string sSTATUS, string sSTATUS_DESCRIPTION, string sDEPARTMENT, Guid gREPORTS_TO_ID, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sACCOUNT_NAME, Guid gCAMPAIGN_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_ConvertProspect";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parPROSPECT_ID                = Sql.AddParameter(cmd, "@PROSPECT_ID"               , gPROSPECT_ID                 );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
							IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  ,  25);
							IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   ,  25);
							IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       , 100);
							IDbDataParameter parREFERED_BY                 = Sql.AddParameter(cmd, "@REFERED_BY"                , sREFERED_BY                  , 100);
							IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
							IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.AddParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , sLEAD_SOURCE_DESCRIPTION     );
							IDbDataParameter parSTATUS                     = Sql.AddParameter(cmd, "@STATUS"                    , sSTATUS                      , 100);
							IDbDataParameter parSTATUS_DESCRIPTION         = Sql.AddParameter(cmd, "@STATUS_DESCRIPTION"        , sSTATUS_DESCRIPTION          );
							IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
							IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
							IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
							IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
							IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
							IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
							IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
							IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
							IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
							IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
							IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
							IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
							IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
							IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
							IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
							IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
							IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
							IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
							IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
							IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
							IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
							IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
							IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_ConvertProspect
		/// <summary>
		/// spLEADS_ConvertProspect
		/// </summary>
		public static void spLEADS_ConvertProspect(ref Guid gID, Guid gPROSPECT_ID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sREFERED_BY, string sLEAD_SOURCE, string sLEAD_SOURCE_DESCRIPTION, string sSTATUS, string sSTATUS_DESCRIPTION, string sDEPARTMENT, Guid gREPORTS_TO_ID, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sACCOUNT_NAME, Guid gCAMPAIGN_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_ConvertProspect";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parPROSPECT_ID                = Sql.AddParameter(cmd, "@PROSPECT_ID"               , gPROSPECT_ID                 );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
				IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  ,  25);
				IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   ,  25);
				IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       , 100);
				IDbDataParameter parREFERED_BY                 = Sql.AddParameter(cmd, "@REFERED_BY"                , sREFERED_BY                  , 100);
				IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
				IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.AddParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , sLEAD_SOURCE_DESCRIPTION     );
				IDbDataParameter parSTATUS                     = Sql.AddParameter(cmd, "@STATUS"                    , sSTATUS                      , 100);
				IDbDataParameter parSTATUS_DESCRIPTION         = Sql.AddParameter(cmd, "@STATUS_DESCRIPTION"        , sSTATUS_DESCRIPTION          );
				IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
				IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
				IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
				IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
				IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
				IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
				IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
				IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
				IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
				IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
				IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
				IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
				IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
				IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
				IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
				IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
				IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
				IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
				IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
				IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
				IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
				IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
				IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdLEADS_ConvertProspect
		/// <summary>
		/// spLEADS_ConvertProspect
		/// </summary>
		public static IDbCommand cmdLEADS_ConvertProspect(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_ConvertProspect";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parPROSPECT_ID                = Sql.CreateParameter(cmd, "@PROSPECT_ID"               , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parSALUTATION                 = Sql.CreateParameter(cmd, "@SALUTATION"                , "string",   5);
			IDbDataParameter parFIRST_NAME                 = Sql.CreateParameter(cmd, "@FIRST_NAME"                , "string",  25);
			IDbDataParameter parLAST_NAME                  = Sql.CreateParameter(cmd, "@LAST_NAME"                 , "string",  25);
			IDbDataParameter parTITLE                      = Sql.CreateParameter(cmd, "@TITLE"                     , "string", 100);
			IDbDataParameter parREFERED_BY                 = Sql.CreateParameter(cmd, "@REFERED_BY"                , "string", 100);
			IDbDataParameter parLEAD_SOURCE                = Sql.CreateParameter(cmd, "@LEAD_SOURCE"               , "string", 100);
			IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.CreateParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , "string", 104857600);
			IDbDataParameter parSTATUS                     = Sql.CreateParameter(cmd, "@STATUS"                    , "string", 100);
			IDbDataParameter parSTATUS_DESCRIPTION         = Sql.CreateParameter(cmd, "@STATUS_DESCRIPTION"        , "string", 104857600);
			IDbDataParameter parDEPARTMENT                 = Sql.CreateParameter(cmd, "@DEPARTMENT"                , "string", 100);
			IDbDataParameter parREPORTS_TO_ID              = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"             , "Guid",  16);
			IDbDataParameter parDO_NOT_CALL                = Sql.CreateParameter(cmd, "@DO_NOT_CALL"               , "bool",   1);
			IDbDataParameter parPHONE_HOME                 = Sql.CreateParameter(cmd, "@PHONE_HOME"                , "string",  25);
			IDbDataParameter parPHONE_MOBILE               = Sql.CreateParameter(cmd, "@PHONE_MOBILE"              , "string",  25);
			IDbDataParameter parPHONE_WORK                 = Sql.CreateParameter(cmd, "@PHONE_WORK"                , "string",  25);
			IDbDataParameter parPHONE_OTHER                = Sql.CreateParameter(cmd, "@PHONE_OTHER"               , "string",  25);
			IDbDataParameter parPHONE_FAX                  = Sql.CreateParameter(cmd, "@PHONE_FAX"                 , "string",  25);
			IDbDataParameter parEMAIL1                     = Sql.CreateParameter(cmd, "@EMAIL1"                    , "string", 100);
			IDbDataParameter parEMAIL2                     = Sql.CreateParameter(cmd, "@EMAIL2"                    , "string", 100);
			IDbDataParameter parEMAIL_OPT_OUT              = Sql.CreateParameter(cmd, "@EMAIL_OPT_OUT"             , "bool",   1);
			IDbDataParameter parINVALID_EMAIL              = Sql.CreateParameter(cmd, "@INVALID_EMAIL"             , "bool",   1);
			IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parALT_ADDRESS_STREET         = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STREET"        , "string", 150);
			IDbDataParameter parALT_ADDRESS_CITY           = Sql.CreateParameter(cmd, "@ALT_ADDRESS_CITY"          , "string", 100);
			IDbDataParameter parALT_ADDRESS_STATE          = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STATE"         , "string", 100);
			IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.CreateParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , "string",  20);
			IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.CreateParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , "string", 100);
			IDbDataParameter parDESCRIPTION                = Sql.CreateParameter(cmd, "@DESCRIPTION"               , "string", 104857600);
			IDbDataParameter parACCOUNT_NAME               = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"              , "string", 150);
			IDbDataParameter parCAMPAIGN_ID                = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"               , "Guid",  16);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spLEADS_Delete
		/// <summary>
		/// spLEADS_Delete
		/// </summary>
		public static void spLEADS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_Delete
		/// <summary>
		/// spLEADS_Delete
		/// </summary>
		public static void spLEADS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLEADS_Delete
		/// <summary>
		/// spLEADS_Delete
		/// </summary>
		public static IDbCommand cmdLEADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLEADS_MassDelete
		/// <summary>
		/// spLEADS_MassDelete
		/// </summary>
		public static void spLEADS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_MassDelete
		/// <summary>
		/// spLEADS_MassDelete
		/// </summary>
		public static void spLEADS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLEADS_MassDelete
		/// <summary>
		/// spLEADS_MassDelete
		/// </summary>
		public static IDbCommand cmdLEADS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLEADS_MassUpdate
		/// <summary>
		/// spLEADS_MassUpdate
		/// </summary>
		public static void spLEADS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sLEAD_SOURCE, string sSTATUS, Guid gREPORTS_TO_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       , 100);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            , 100);
							IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_MassUpdate
		/// <summary>
		/// spLEADS_MassUpdate
		/// </summary>
		public static void spLEADS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sLEAD_SOURCE, string sSTATUS, Guid gREPORTS_TO_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       , 100);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            , 100);
				IDbDataParameter parREPORTS_TO_ID    = Sql.AddParameter(cmd, "@REPORTS_TO_ID"   , gREPORTS_TO_ID     );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLEADS_MassUpdate
		/// <summary>
		/// spLEADS_MassUpdate
		/// </summary>
		public static IDbCommand cmdLEADS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parLEAD_SOURCE      = Sql.CreateParameter(cmd, "@LEAD_SOURCE"     , "string", 100);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string", 100);
			IDbDataParameter parREPORTS_TO_ID    = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"   , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLEADS_New
		/// <summary>
		/// spLEADS_New
		/// </summary>
		public static void spLEADS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
							IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
							IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
							IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_New
		/// <summary>
		/// spLEADS_New
		/// </summary>
		public static void spLEADS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
				IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
				IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
				IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdLEADS_New
		/// <summary>
		/// spLEADS_New
		/// </summary>
		public static IDbCommand cmdLEADS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFIRST_NAME       = Sql.CreateParameter(cmd, "@FIRST_NAME"      , "string", 100);
			IDbDataParameter parLAST_NAME        = Sql.CreateParameter(cmd, "@LAST_NAME"       , "string", 100);
			IDbDataParameter parPHONE_WORK       = Sql.CreateParameter(cmd, "@PHONE_WORK"      , "string",  25);
			IDbDataParameter parEMAIL1           = Sql.CreateParameter(cmd, "@EMAIL1"          , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spLEADS_THREADS_Delete
		/// <summary>
		/// spLEADS_THREADS_Delete
		/// </summary>
		public static void spLEADS_THREADS_Delete(Guid gLEAD_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_THREADS_Delete
		/// <summary>
		/// spLEADS_THREADS_Delete
		/// </summary>
		public static void spLEADS_THREADS_Delete(Guid gLEAD_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLEADS_THREADS_Delete
		/// <summary>
		/// spLEADS_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdLEADS_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLEADS_THREADS_Update
		/// <summary>
		/// spLEADS_THREADS_Update
		/// </summary>
		public static void spLEADS_THREADS_Update(Guid gLEAD_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_THREADS_Update
		/// <summary>
		/// spLEADS_THREADS_Update
		/// </summary>
		public static void spLEADS_THREADS_Update(Guid gLEAD_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLEADS_THREADS_Update
		/// <summary>
		/// spLEADS_THREADS_Update
		/// </summary>
		public static IDbCommand cmdLEADS_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLEADS_Update
		/// <summary>
		/// spLEADS_Update
		/// </summary>
		public static void spLEADS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sREFERED_BY, string sLEAD_SOURCE, string sLEAD_SOURCE_DESCRIPTION, string sSTATUS, string sSTATUS_DESCRIPTION, string sDEPARTMENT, Guid gREPORTS_TO_ID, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sACCOUNT_NAME, Guid gCAMPAIGN_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLEADS_Update";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
							IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  ,  25);
							IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   ,  25);
							IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       , 100);
							IDbDataParameter parREFERED_BY                 = Sql.AddParameter(cmd, "@REFERED_BY"                , sREFERED_BY                  , 100);
							IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
							IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.AddParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , sLEAD_SOURCE_DESCRIPTION     );
							IDbDataParameter parSTATUS                     = Sql.AddParameter(cmd, "@STATUS"                    , sSTATUS                      , 100);
							IDbDataParameter parSTATUS_DESCRIPTION         = Sql.AddParameter(cmd, "@STATUS_DESCRIPTION"        , sSTATUS_DESCRIPTION          );
							IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
							IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
							IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
							IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
							IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
							IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
							IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
							IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
							IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
							IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
							IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
							IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
							IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
							IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
							IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
							IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
							IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
							IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
							IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
							IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
							IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
							IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
							IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLEADS_Update
		/// <summary>
		/// spLEADS_Update
		/// </summary>
		public static void spLEADS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sREFERED_BY, string sLEAD_SOURCE, string sLEAD_SOURCE_DESCRIPTION, string sSTATUS, string sSTATUS_DESCRIPTION, string sDEPARTMENT, Guid gREPORTS_TO_ID, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sACCOUNT_NAME, Guid gCAMPAIGN_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLEADS_Update";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
				IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  ,  25);
				IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   ,  25);
				IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       , 100);
				IDbDataParameter parREFERED_BY                 = Sql.AddParameter(cmd, "@REFERED_BY"                , sREFERED_BY                  , 100);
				IDbDataParameter parLEAD_SOURCE                = Sql.AddParameter(cmd, "@LEAD_SOURCE"               , sLEAD_SOURCE                 , 100);
				IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.AddParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , sLEAD_SOURCE_DESCRIPTION     );
				IDbDataParameter parSTATUS                     = Sql.AddParameter(cmd, "@STATUS"                    , sSTATUS                      , 100);
				IDbDataParameter parSTATUS_DESCRIPTION         = Sql.AddParameter(cmd, "@STATUS_DESCRIPTION"        , sSTATUS_DESCRIPTION          );
				IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 100);
				IDbDataParameter parREPORTS_TO_ID              = Sql.AddParameter(cmd, "@REPORTS_TO_ID"             , gREPORTS_TO_ID               );
				IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
				IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
				IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
				IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
				IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
				IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
				IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
				IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
				IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
				IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
				IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
				IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
				IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
				IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
				IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
				IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
				IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
				IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
				IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
				IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
				IDbDataParameter parCAMPAIGN_ID                = Sql.AddParameter(cmd, "@CAMPAIGN_ID"               , gCAMPAIGN_ID                 );
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdLEADS_Update
		/// <summary>
		/// spLEADS_Update
		/// </summary>
		public static IDbCommand cmdLEADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLEADS_Update";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parSALUTATION                 = Sql.CreateParameter(cmd, "@SALUTATION"                , "string",   5);
			IDbDataParameter parFIRST_NAME                 = Sql.CreateParameter(cmd, "@FIRST_NAME"                , "string",  25);
			IDbDataParameter parLAST_NAME                  = Sql.CreateParameter(cmd, "@LAST_NAME"                 , "string",  25);
			IDbDataParameter parTITLE                      = Sql.CreateParameter(cmd, "@TITLE"                     , "string", 100);
			IDbDataParameter parREFERED_BY                 = Sql.CreateParameter(cmd, "@REFERED_BY"                , "string", 100);
			IDbDataParameter parLEAD_SOURCE                = Sql.CreateParameter(cmd, "@LEAD_SOURCE"               , "string", 100);
			IDbDataParameter parLEAD_SOURCE_DESCRIPTION    = Sql.CreateParameter(cmd, "@LEAD_SOURCE_DESCRIPTION"   , "string", 104857600);
			IDbDataParameter parSTATUS                     = Sql.CreateParameter(cmd, "@STATUS"                    , "string", 100);
			IDbDataParameter parSTATUS_DESCRIPTION         = Sql.CreateParameter(cmd, "@STATUS_DESCRIPTION"        , "string", 104857600);
			IDbDataParameter parDEPARTMENT                 = Sql.CreateParameter(cmd, "@DEPARTMENT"                , "string", 100);
			IDbDataParameter parREPORTS_TO_ID              = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"             , "Guid",  16);
			IDbDataParameter parDO_NOT_CALL                = Sql.CreateParameter(cmd, "@DO_NOT_CALL"               , "bool",   1);
			IDbDataParameter parPHONE_HOME                 = Sql.CreateParameter(cmd, "@PHONE_HOME"                , "string",  25);
			IDbDataParameter parPHONE_MOBILE               = Sql.CreateParameter(cmd, "@PHONE_MOBILE"              , "string",  25);
			IDbDataParameter parPHONE_WORK                 = Sql.CreateParameter(cmd, "@PHONE_WORK"                , "string",  25);
			IDbDataParameter parPHONE_OTHER                = Sql.CreateParameter(cmd, "@PHONE_OTHER"               , "string",  25);
			IDbDataParameter parPHONE_FAX                  = Sql.CreateParameter(cmd, "@PHONE_FAX"                 , "string",  25);
			IDbDataParameter parEMAIL1                     = Sql.CreateParameter(cmd, "@EMAIL1"                    , "string", 100);
			IDbDataParameter parEMAIL2                     = Sql.CreateParameter(cmd, "@EMAIL2"                    , "string", 100);
			IDbDataParameter parEMAIL_OPT_OUT              = Sql.CreateParameter(cmd, "@EMAIL_OPT_OUT"             , "bool",   1);
			IDbDataParameter parINVALID_EMAIL              = Sql.CreateParameter(cmd, "@INVALID_EMAIL"             , "bool",   1);
			IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parALT_ADDRESS_STREET         = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STREET"        , "string", 150);
			IDbDataParameter parALT_ADDRESS_CITY           = Sql.CreateParameter(cmd, "@ALT_ADDRESS_CITY"          , "string", 100);
			IDbDataParameter parALT_ADDRESS_STATE          = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STATE"         , "string", 100);
			IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.CreateParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , "string",  20);
			IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.CreateParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , "string", 100);
			IDbDataParameter parDESCRIPTION                = Sql.CreateParameter(cmd, "@DESCRIPTION"               , "string", 104857600);
			IDbDataParameter parACCOUNT_NAME               = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"              , "string", 150);
			IDbDataParameter parCAMPAIGN_ID                = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"               , "Guid",  16);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spLINKED_DOCUMENTS_Delete
		/// <summary>
		/// spLINKED_DOCUMENTS_Delete
		/// </summary>
		public static void spLINKED_DOCUMENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLINKED_DOCUMENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLINKED_DOCUMENTS_Delete
		/// <summary>
		/// spLINKED_DOCUMENTS_Delete
		/// </summary>
		public static void spLINKED_DOCUMENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLINKED_DOCUMENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdLINKED_DOCUMENTS_Delete
		/// <summary>
		/// spLINKED_DOCUMENTS_Delete
		/// </summary>
		public static IDbCommand cmdLINKED_DOCUMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLINKED_DOCUMENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spLINKED_DOCUMENTS_Update
		/// <summary>
		/// spLINKED_DOCUMENTS_Update
		/// </summary>
		public static void spLINKED_DOCUMENTS_Update(ref Guid gID, Guid gPARENT_ID, string sPARENT_TYPE, Guid gDOCUMENT_ID, Guid gDOCUMENT_REVISION_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spLINKED_DOCUMENTS_Update";
							IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
							IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
							IDbDataParameter parPARENT_ID            = Sql.AddParameter(cmd, "@PARENT_ID"           , gPARENT_ID             );
							IDbDataParameter parPARENT_TYPE          = Sql.AddParameter(cmd, "@PARENT_TYPE"         , sPARENT_TYPE           ,  25);
							IDbDataParameter parDOCUMENT_ID          = Sql.AddParameter(cmd, "@DOCUMENT_ID"         , gDOCUMENT_ID           );
							IDbDataParameter parDOCUMENT_REVISION_ID = Sql.AddParameter(cmd, "@DOCUMENT_REVISION_ID", gDOCUMENT_REVISION_ID  );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spLINKED_DOCUMENTS_Update
		/// <summary>
		/// spLINKED_DOCUMENTS_Update
		/// </summary>
		public static void spLINKED_DOCUMENTS_Update(ref Guid gID, Guid gPARENT_ID, string sPARENT_TYPE, Guid gDOCUMENT_ID, Guid gDOCUMENT_REVISION_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spLINKED_DOCUMENTS_Update";
				IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
				IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
				IDbDataParameter parPARENT_ID            = Sql.AddParameter(cmd, "@PARENT_ID"           , gPARENT_ID             );
				IDbDataParameter parPARENT_TYPE          = Sql.AddParameter(cmd, "@PARENT_TYPE"         , sPARENT_TYPE           ,  25);
				IDbDataParameter parDOCUMENT_ID          = Sql.AddParameter(cmd, "@DOCUMENT_ID"         , gDOCUMENT_ID           );
				IDbDataParameter parDOCUMENT_REVISION_ID = Sql.AddParameter(cmd, "@DOCUMENT_REVISION_ID", gDOCUMENT_REVISION_ID  );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdLINKED_DOCUMENTS_Update
		/// <summary>
		/// spLINKED_DOCUMENTS_Update
		/// </summary>
		public static IDbCommand cmdLINKED_DOCUMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spLINKED_DOCUMENTS_Update";
			IDbDataParameter parID                   = Sql.CreateParameter(cmd, "@ID"                  , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID     = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"    , "Guid",  16);
			IDbDataParameter parPARENT_ID            = Sql.CreateParameter(cmd, "@PARENT_ID"           , "Guid",  16);
			IDbDataParameter parPARENT_TYPE          = Sql.CreateParameter(cmd, "@PARENT_TYPE"         , "string",  25);
			IDbDataParameter parDOCUMENT_ID          = Sql.CreateParameter(cmd, "@DOCUMENT_ID"         , "Guid",  16);
			IDbDataParameter parDOCUMENT_REVISION_ID = Sql.CreateParameter(cmd, "@DOCUMENT_REVISION_ID", "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spMANUFACTURERS_Delete
		/// <summary>
		/// spMANUFACTURERS_Delete
		/// </summary>
		public static void spMANUFACTURERS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMANUFACTURERS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMANUFACTURERS_Delete
		/// <summary>
		/// spMANUFACTURERS_Delete
		/// </summary>
		public static void spMANUFACTURERS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMANUFACTURERS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMANUFACTURERS_Delete
		/// <summary>
		/// spMANUFACTURERS_Delete
		/// </summary>
		public static IDbCommand cmdMANUFACTURERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMANUFACTURERS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMANUFACTURERS_Update
		/// <summary>
		/// spMANUFACTURERS_Update
		/// </summary>
		public static void spMANUFACTURERS_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMANUFACTURERS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMANUFACTURERS_Update
		/// <summary>
		/// spMANUFACTURERS_Update
		/// </summary>
		public static void spMANUFACTURERS_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMANUFACTURERS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdMANUFACTURERS_Update
		/// <summary>
		/// spMANUFACTURERS_Update
		/// </summary>
		public static IDbCommand cmdMANUFACTURERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMANUFACTURERS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spMEETINGS_CONTACTS_Delete
		/// <summary>
		/// spMEETINGS_CONTACTS_Delete
		/// </summary>
		public static void spMEETINGS_CONTACTS_Delete(Guid gMEETING_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_CONTACTS_Delete
		/// <summary>
		/// spMEETINGS_CONTACTS_Delete
		/// </summary>
		public static void spMEETINGS_CONTACTS_Delete(Guid gMEETING_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_CONTACTS_Delete
		/// <summary>
		/// spMEETINGS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdMEETINGS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMEETING_ID       = Sql.CreateParameter(cmd, "@MEETING_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMEETINGS_CONTACTS_Update
		/// <summary>
		/// spMEETINGS_CONTACTS_Update
		/// </summary>
		public static void spMEETINGS_CONTACTS_Update(Guid gMEETING_ID, Guid gCONTACT_ID, bool bREQUIRED, string sACCEPT_STATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_CONTACTS_Update
		/// <summary>
		/// spMEETINGS_CONTACTS_Update
		/// </summary>
		public static void spMEETINGS_CONTACTS_Update(Guid gMEETING_ID, Guid gCONTACT_ID, bool bREQUIRED, string sACCEPT_STATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_CONTACTS_Update
		/// <summary>
		/// spMEETINGS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdMEETINGS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMEETING_ID       = Sql.CreateParameter(cmd, "@MEETING_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parACCEPT_STATUS    = Sql.CreateParameter(cmd, "@ACCEPT_STATUS"   , "string",  25);
			return cmd;
		}
		#endregion

		#region spMEETINGS_Delete
		/// <summary>
		/// spMEETINGS_Delete
		/// </summary>
		public static void spMEETINGS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_Delete
		/// <summary>
		/// spMEETINGS_Delete
		/// </summary>
		public static void spMEETINGS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_Delete
		/// <summary>
		/// spMEETINGS_Delete
		/// </summary>
		public static IDbCommand cmdMEETINGS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMEETINGS_InviteeMassUpdate
		/// <summary>
		/// spMEETINGS_InviteeMassUpdate
		/// </summary>
		public static void spMEETINGS_InviteeMassUpdate(Guid gMEETING_ID, string sID_LIST, bool bREQUIRED)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_InviteeMassUpdate";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_InviteeMassUpdate
		/// <summary>
		/// spMEETINGS_InviteeMassUpdate
		/// </summary>
		public static void spMEETINGS_InviteeMassUpdate(Guid gMEETING_ID, string sID_LIST, bool bREQUIRED, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_InviteeMassUpdate";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_InviteeMassUpdate
		/// <summary>
		/// spMEETINGS_InviteeMassUpdate
		/// </summary>
		public static IDbCommand cmdMEETINGS_InviteeMassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_InviteeMassUpdate";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMEETING_ID       = Sql.CreateParameter(cmd, "@MEETING_ID"      , "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			return cmd;
		}
		#endregion

		#region spMEETINGS_MassDelete
		/// <summary>
		/// spMEETINGS_MassDelete
		/// </summary>
		public static void spMEETINGS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_MassDelete
		/// <summary>
		/// spMEETINGS_MassDelete
		/// </summary>
		public static void spMEETINGS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_MassDelete
		/// <summary>
		/// spMEETINGS_MassDelete
		/// </summary>
		public static IDbCommand cmdMEETINGS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMEETINGS_MassUpdate
		/// <summary>
		/// spMEETINGS_MassUpdate
		/// </summary>
		public static void spMEETINGS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtDATE_TIME, string sSTATUS, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_MassUpdate
		/// <summary>
		/// spMEETINGS_MassUpdate
		/// </summary>
		public static void spMEETINGS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtDATE_TIME, string sSTATUS, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_MassUpdate
		/// <summary>
		/// spMEETINGS_MassUpdate
		/// </summary>
		public static IDbCommand cmdMEETINGS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMEETINGS_New
		/// <summary>
		/// spMEETINGS_New
		/// </summary>
		public static void spMEETINGS_New(ref Guid gID, string sNAME, DateTime dtDATE_TIME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_New
		/// <summary>
		/// spMEETINGS_New
		/// </summary>
		public static void spMEETINGS_New(ref Guid gID, string sNAME, DateTime dtDATE_TIME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdMEETINGS_New
		/// <summary>
		/// spMEETINGS_New
		/// </summary>
		public static IDbCommand cmdMEETINGS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spMEETINGS_Update
		/// <summary>
		/// spMEETINGS_Update
		/// </summary>
		public static void spMEETINGS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sLOCATION, Int32 nDURATION_HOURS, Int32 nDURATION_MINUTES, DateTime dtDATE_TIME, string sSTATUS, string sPARENT_TYPE, Guid gPARENT_ID, Int32 nREMINDER_TIME, string sDESCRIPTION, string sINVITEE_LIST, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parLOCATION         = Sql.AddParameter(cmd, "@LOCATION"        , sLOCATION          ,  50);
							IDbDataParameter parDURATION_HOURS   = Sql.AddParameter(cmd, "@DURATION_HOURS"  , nDURATION_HOURS    );
							IDbDataParameter parDURATION_MINUTES = Sql.AddParameter(cmd, "@DURATION_MINUTES", nDURATION_MINUTES  );
							IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parREMINDER_TIME    = Sql.AddParameter(cmd, "@REMINDER_TIME"   , nREMINDER_TIME     );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parINVITEE_LIST     = Sql.AddAnsiParam(cmd, "@INVITEE_LIST"    , sINVITEE_LIST      , 8000);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_Update
		/// <summary>
		/// spMEETINGS_Update
		/// </summary>
		public static void spMEETINGS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sLOCATION, Int32 nDURATION_HOURS, Int32 nDURATION_MINUTES, DateTime dtDATE_TIME, string sSTATUS, string sPARENT_TYPE, Guid gPARENT_ID, Int32 nREMINDER_TIME, string sDESCRIPTION, string sINVITEE_LIST, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parLOCATION         = Sql.AddParameter(cmd, "@LOCATION"        , sLOCATION          ,  50);
				IDbDataParameter parDURATION_HOURS   = Sql.AddParameter(cmd, "@DURATION_HOURS"  , nDURATION_HOURS    );
				IDbDataParameter parDURATION_MINUTES = Sql.AddParameter(cmd, "@DURATION_MINUTES", nDURATION_MINUTES  );
				IDbDataParameter parDATE_TIME        = Sql.AddParameter(cmd, "@DATE_TIME"       , dtDATE_TIME        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parREMINDER_TIME    = Sql.AddParameter(cmd, "@REMINDER_TIME"   , nREMINDER_TIME     );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parINVITEE_LIST     = Sql.AddAnsiParam(cmd, "@INVITEE_LIST"    , sINVITEE_LIST      , 8000);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdMEETINGS_Update
		/// <summary>
		/// spMEETINGS_Update
		/// </summary>
		public static IDbCommand cmdMEETINGS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parLOCATION         = Sql.CreateParameter(cmd, "@LOCATION"        , "string",  50);
			IDbDataParameter parDURATION_HOURS   = Sql.CreateParameter(cmd, "@DURATION_HOURS"  , "Int32",   4);
			IDbDataParameter parDURATION_MINUTES = Sql.CreateParameter(cmd, "@DURATION_MINUTES", "Int32",   4);
			IDbDataParameter parDATE_TIME        = Sql.CreateParameter(cmd, "@DATE_TIME"       , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parREMINDER_TIME    = Sql.CreateParameter(cmd, "@REMINDER_TIME"   , "Int32",   4);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parINVITEE_LIST     = Sql.CreateParameter(cmd, "@INVITEE_LIST"    , "ansistring", 8000);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spMEETINGS_USERS_Delete
		/// <summary>
		/// spMEETINGS_USERS_Delete
		/// </summary>
		public static void spMEETINGS_USERS_Delete(Guid gMEETING_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_USERS_Delete
		/// <summary>
		/// spMEETINGS_USERS_Delete
		/// </summary>
		public static void spMEETINGS_USERS_Delete(Guid gMEETING_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_USERS_Delete
		/// <summary>
		/// spMEETINGS_USERS_Delete
		/// </summary>
		public static IDbCommand cmdMEETINGS_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMEETING_ID       = Sql.CreateParameter(cmd, "@MEETING_ID"      , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMEETINGS_USERS_Update
		/// <summary>
		/// spMEETINGS_USERS_Update
		/// </summary>
		public static void spMEETINGS_USERS_Update(Guid gMEETING_ID, Guid gUSER_ID, bool bREQUIRED, string sACCEPT_STATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMEETINGS_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
							IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMEETINGS_USERS_Update
		/// <summary>
		/// spMEETINGS_USERS_Update
		/// </summary>
		public static void spMEETINGS_USERS_Update(Guid gMEETING_ID, Guid gUSER_ID, bool bREQUIRED, string sACCEPT_STATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMEETINGS_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMEETING_ID       = Sql.AddParameter(cmd, "@MEETING_ID"      , gMEETING_ID        );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parREQUIRED         = Sql.AddParameter(cmd, "@REQUIRED"        , bREQUIRED          );
				IDbDataParameter parACCEPT_STATUS    = Sql.AddParameter(cmd, "@ACCEPT_STATUS"   , sACCEPT_STATUS     ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMEETINGS_USERS_Update
		/// <summary>
		/// spMEETINGS_USERS_Update
		/// </summary>
		public static IDbCommand cmdMEETINGS_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMEETINGS_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMEETING_ID       = Sql.CreateParameter(cmd, "@MEETING_ID"      , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parREQUIRED         = Sql.CreateParameter(cmd, "@REQUIRED"        , "bool",   1);
			IDbDataParameter parACCEPT_STATUS    = Sql.CreateParameter(cmd, "@ACCEPT_STATUS"   , "string",  25);
			return cmd;
		}
		#endregion

		#region spMODULES_Delete
		/// <summary>
		/// spMODULES_Delete
		/// </summary>
		public static void spMODULES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_Delete
		/// <summary>
		/// spMODULES_Delete
		/// </summary>
		public static void spMODULES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_Delete
		/// <summary>
		/// spMODULES_Delete
		/// </summary>
		public static IDbCommand cmdMODULES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_Disable
		/// <summary>
		/// spMODULES_Disable
		/// </summary>
		public static void spMODULES_Disable(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_Disable";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_Disable
		/// <summary>
		/// spMODULES_Disable
		/// </summary>
		public static void spMODULES_Disable(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_Disable";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_Disable
		/// <summary>
		/// spMODULES_Disable
		/// </summary>
		public static IDbCommand cmdMODULES_Disable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_Disable";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_Enable
		/// <summary>
		/// spMODULES_Enable
		/// </summary>
		public static void spMODULES_Enable(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_Enable";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_Enable
		/// <summary>
		/// spMODULES_Enable
		/// </summary>
		public static void spMODULES_Enable(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_Enable";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_Enable
		/// <summary>
		/// spMODULES_Enable
		/// </summary>
		public static IDbCommand cmdMODULES_Enable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_Enable";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_InsertOnly
		/// <summary>
		/// spMODULES_InsertOnly
		/// </summary>
		public static void spMODULES_InsertOnly(string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, bool bMODULE_ENABLED, bool bTAB_ENABLED, Int32 nTAB_ORDER, bool bPORTAL_ENABLED, bool bCUSTOM_ENABLED, bool bREPORT_ENABLED, bool bIMPORT_ENABLED, bool bIS_ADMIN, string sTABLE_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  50);
							IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     ,  50);
							IDbDataParameter parMODULE_ENABLED   = Sql.AddParameter(cmd, "@MODULE_ENABLED"  , bMODULE_ENABLED    );
							IDbDataParameter parTAB_ENABLED      = Sql.AddParameter(cmd, "@TAB_ENABLED"     , bTAB_ENABLED       );
							IDbDataParameter parTAB_ORDER        = Sql.AddParameter(cmd, "@TAB_ORDER"       , nTAB_ORDER         );
							IDbDataParameter parPORTAL_ENABLED   = Sql.AddParameter(cmd, "@PORTAL_ENABLED"  , bPORTAL_ENABLED    );
							IDbDataParameter parCUSTOM_ENABLED   = Sql.AddParameter(cmd, "@CUSTOM_ENABLED"  , bCUSTOM_ENABLED    );
							IDbDataParameter parREPORT_ENABLED   = Sql.AddParameter(cmd, "@REPORT_ENABLED"  , bREPORT_ENABLED    );
							IDbDataParameter parIMPORT_ENABLED   = Sql.AddParameter(cmd, "@IMPORT_ENABLED"  , bIMPORT_ENABLED    );
							IDbDataParameter parIS_ADMIN         = Sql.AddParameter(cmd, "@IS_ADMIN"        , bIS_ADMIN          );
							IDbDataParameter parTABLE_NAME       = Sql.AddParameter(cmd, "@TABLE_NAME"      , sTABLE_NAME        ,  30);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_InsertOnly
		/// <summary>
		/// spMODULES_InsertOnly
		/// </summary>
		public static void spMODULES_InsertOnly(string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, bool bMODULE_ENABLED, bool bTAB_ENABLED, Int32 nTAB_ORDER, bool bPORTAL_ENABLED, bool bCUSTOM_ENABLED, bool bREPORT_ENABLED, bool bIMPORT_ENABLED, bool bIS_ADMIN, string sTABLE_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  50);
				IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     ,  50);
				IDbDataParameter parMODULE_ENABLED   = Sql.AddParameter(cmd, "@MODULE_ENABLED"  , bMODULE_ENABLED    );
				IDbDataParameter parTAB_ENABLED      = Sql.AddParameter(cmd, "@TAB_ENABLED"     , bTAB_ENABLED       );
				IDbDataParameter parTAB_ORDER        = Sql.AddParameter(cmd, "@TAB_ORDER"       , nTAB_ORDER         );
				IDbDataParameter parPORTAL_ENABLED   = Sql.AddParameter(cmd, "@PORTAL_ENABLED"  , bPORTAL_ENABLED    );
				IDbDataParameter parCUSTOM_ENABLED   = Sql.AddParameter(cmd, "@CUSTOM_ENABLED"  , bCUSTOM_ENABLED    );
				IDbDataParameter parREPORT_ENABLED   = Sql.AddParameter(cmd, "@REPORT_ENABLED"  , bREPORT_ENABLED    );
				IDbDataParameter parIMPORT_ENABLED   = Sql.AddParameter(cmd, "@IMPORT_ENABLED"  , bIMPORT_ENABLED    );
				IDbDataParameter parIS_ADMIN         = Sql.AddParameter(cmd, "@IS_ADMIN"        , bIS_ADMIN          );
				IDbDataParameter parTABLE_NAME       = Sql.AddParameter(cmd, "@TABLE_NAME"      , sTABLE_NAME        ,  30);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_InsertOnly
		/// <summary>
		/// spMODULES_InsertOnly
		/// </summary>
		public static IDbCommand cmdMODULES_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string",  50);
			IDbDataParameter parRELATIVE_PATH    = Sql.CreateParameter(cmd, "@RELATIVE_PATH"   , "string",  50);
			IDbDataParameter parMODULE_ENABLED   = Sql.CreateParameter(cmd, "@MODULE_ENABLED"  , "bool",   1);
			IDbDataParameter parTAB_ENABLED      = Sql.CreateParameter(cmd, "@TAB_ENABLED"     , "bool",   1);
			IDbDataParameter parTAB_ORDER        = Sql.CreateParameter(cmd, "@TAB_ORDER"       , "Int32",   4);
			IDbDataParameter parPORTAL_ENABLED   = Sql.CreateParameter(cmd, "@PORTAL_ENABLED"  , "bool",   1);
			IDbDataParameter parCUSTOM_ENABLED   = Sql.CreateParameter(cmd, "@CUSTOM_ENABLED"  , "bool",   1);
			IDbDataParameter parREPORT_ENABLED   = Sql.CreateParameter(cmd, "@REPORT_ENABLED"  , "bool",   1);
			IDbDataParameter parIMPORT_ENABLED   = Sql.CreateParameter(cmd, "@IMPORT_ENABLED"  , "bool",   1);
			IDbDataParameter parIS_ADMIN         = Sql.CreateParameter(cmd, "@IS_ADMIN"        , "bool",   1);
			IDbDataParameter parTABLE_NAME       = Sql.CreateParameter(cmd, "@TABLE_NAME"      , "string",  30);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_Hide
		/// <summary>
		/// spMODULES_TAB_Hide
		/// </summary>
		public static void spMODULES_TAB_Hide(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_Hide";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_Hide
		/// <summary>
		/// spMODULES_TAB_Hide
		/// </summary>
		public static void spMODULES_TAB_Hide(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_Hide";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_Hide
		/// <summary>
		/// spMODULES_TAB_Hide
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_Hide(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_Hide";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_HideMobile
		/// <summary>
		/// spMODULES_TAB_HideMobile
		/// </summary>
		public static void spMODULES_TAB_HideMobile(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_HideMobile";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_HideMobile
		/// <summary>
		/// spMODULES_TAB_HideMobile
		/// </summary>
		public static void spMODULES_TAB_HideMobile(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_HideMobile";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_HideMobile
		/// <summary>
		/// spMODULES_TAB_HideMobile
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_HideMobile(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_HideMobile";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_ORDER_MoveDown
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveDown
		/// </summary>
		public static void spMODULES_TAB_ORDER_MoveDown(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_ORDER_MoveDown";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_ORDER_MoveDown
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveDown
		/// </summary>
		public static void spMODULES_TAB_ORDER_MoveDown(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_ORDER_MoveDown";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_ORDER_MoveDown
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveDown
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_ORDER_MoveDown(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_ORDER_MoveDown";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_ORDER_MoveUp
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveUp
		/// </summary>
		public static void spMODULES_TAB_ORDER_MoveUp(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_ORDER_MoveUp";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_ORDER_MoveUp
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveUp
		/// </summary>
		public static void spMODULES_TAB_ORDER_MoveUp(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_ORDER_MoveUp";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_ORDER_MoveUp
		/// <summary>
		/// spMODULES_TAB_ORDER_MoveUp
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_ORDER_MoveUp(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_ORDER_MoveUp";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_Rename
		/// <summary>
		/// spMODULES_TAB_Rename
		/// </summary>
		public static void spMODULES_TAB_Rename(Guid gID, string sNAME, string sLANG, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_Rename";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 2000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_Rename
		/// <summary>
		/// spMODULES_TAB_Rename
		/// </summary>
		public static void spMODULES_TAB_Rename(Guid gID, string sNAME, string sLANG, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_Rename";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 2000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_Rename
		/// <summary>
		/// spMODULES_TAB_Rename
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_Rename(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_Rename";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parLANG             = Sql.CreateParameter(cmd, "@LANG"            , "string",  10);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string", 2000);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_Show
		/// <summary>
		/// spMODULES_TAB_Show
		/// </summary>
		public static void spMODULES_TAB_Show(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_Show";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_Show
		/// <summary>
		/// spMODULES_TAB_Show
		/// </summary>
		public static void spMODULES_TAB_Show(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_Show";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_Show
		/// <summary>
		/// spMODULES_TAB_Show
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_Show(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_Show";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_TAB_ShowMobile
		/// <summary>
		/// spMODULES_TAB_ShowMobile
		/// </summary>
		public static void spMODULES_TAB_ShowMobile(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_TAB_ShowMobile";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_TAB_ShowMobile
		/// <summary>
		/// spMODULES_TAB_ShowMobile
		/// </summary>
		public static void spMODULES_TAB_ShowMobile(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_TAB_ShowMobile";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdMODULES_TAB_ShowMobile
		/// <summary>
		/// spMODULES_TAB_ShowMobile
		/// </summary>
		public static IDbCommand cmdMODULES_TAB_ShowMobile(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_TAB_ShowMobile";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spMODULES_Update
		/// <summary>
		/// spMODULES_Update
		/// </summary>
		public static void spMODULES_Update(ref Guid gID, string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, bool bMODULE_ENABLED, bool bTAB_ENABLED, Int32 nTAB_ORDER, bool bPORTAL_ENABLED, bool bCUSTOM_ENABLED, bool bREPORT_ENABLED, bool bIS_ADMIN, string sTABLE_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spMODULES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  50);
							IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     ,  50);
							IDbDataParameter parMODULE_ENABLED   = Sql.AddParameter(cmd, "@MODULE_ENABLED"  , bMODULE_ENABLED    );
							IDbDataParameter parTAB_ENABLED      = Sql.AddParameter(cmd, "@TAB_ENABLED"     , bTAB_ENABLED       );
							IDbDataParameter parTAB_ORDER        = Sql.AddParameter(cmd, "@TAB_ORDER"       , nTAB_ORDER         );
							IDbDataParameter parPORTAL_ENABLED   = Sql.AddParameter(cmd, "@PORTAL_ENABLED"  , bPORTAL_ENABLED    );
							IDbDataParameter parCUSTOM_ENABLED   = Sql.AddParameter(cmd, "@CUSTOM_ENABLED"  , bCUSTOM_ENABLED    );
							IDbDataParameter parREPORT_ENABLED   = Sql.AddParameter(cmd, "@REPORT_ENABLED"  , bREPORT_ENABLED    );
							IDbDataParameter parIS_ADMIN         = Sql.AddParameter(cmd, "@IS_ADMIN"        , bIS_ADMIN          );
							IDbDataParameter parTABLE_NAME       = Sql.AddParameter(cmd, "@TABLE_NAME"      , sTABLE_NAME        ,  30);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spMODULES_Update
		/// <summary>
		/// spMODULES_Update
		/// </summary>
		public static void spMODULES_Update(ref Guid gID, string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, bool bMODULE_ENABLED, bool bTAB_ENABLED, Int32 nTAB_ORDER, bool bPORTAL_ENABLED, bool bCUSTOM_ENABLED, bool bREPORT_ENABLED, bool bIS_ADMIN, string sTABLE_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spMODULES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      ,  50);
				IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     ,  50);
				IDbDataParameter parMODULE_ENABLED   = Sql.AddParameter(cmd, "@MODULE_ENABLED"  , bMODULE_ENABLED    );
				IDbDataParameter parTAB_ENABLED      = Sql.AddParameter(cmd, "@TAB_ENABLED"     , bTAB_ENABLED       );
				IDbDataParameter parTAB_ORDER        = Sql.AddParameter(cmd, "@TAB_ORDER"       , nTAB_ORDER         );
				IDbDataParameter parPORTAL_ENABLED   = Sql.AddParameter(cmd, "@PORTAL_ENABLED"  , bPORTAL_ENABLED    );
				IDbDataParameter parCUSTOM_ENABLED   = Sql.AddParameter(cmd, "@CUSTOM_ENABLED"  , bCUSTOM_ENABLED    );
				IDbDataParameter parREPORT_ENABLED   = Sql.AddParameter(cmd, "@REPORT_ENABLED"  , bREPORT_ENABLED    );
				IDbDataParameter parIS_ADMIN         = Sql.AddParameter(cmd, "@IS_ADMIN"        , bIS_ADMIN          );
				IDbDataParameter parTABLE_NAME       = Sql.AddParameter(cmd, "@TABLE_NAME"      , sTABLE_NAME        ,  30);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdMODULES_Update
		/// <summary>
		/// spMODULES_Update
		/// </summary>
		public static IDbCommand cmdMODULES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spMODULES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string",  50);
			IDbDataParameter parRELATIVE_PATH    = Sql.CreateParameter(cmd, "@RELATIVE_PATH"   , "string",  50);
			IDbDataParameter parMODULE_ENABLED   = Sql.CreateParameter(cmd, "@MODULE_ENABLED"  , "bool",   1);
			IDbDataParameter parTAB_ENABLED      = Sql.CreateParameter(cmd, "@TAB_ENABLED"     , "bool",   1);
			IDbDataParameter parTAB_ORDER        = Sql.CreateParameter(cmd, "@TAB_ORDER"       , "Int32",   4);
			IDbDataParameter parPORTAL_ENABLED   = Sql.CreateParameter(cmd, "@PORTAL_ENABLED"  , "bool",   1);
			IDbDataParameter parCUSTOM_ENABLED   = Sql.CreateParameter(cmd, "@CUSTOM_ENABLED"  , "bool",   1);
			IDbDataParameter parREPORT_ENABLED   = Sql.CreateParameter(cmd, "@REPORT_ENABLED"  , "bool",   1);
			IDbDataParameter parIS_ADMIN         = Sql.CreateParameter(cmd, "@IS_ADMIN"        , "bool",   1);
			IDbDataParameter parTABLE_NAME       = Sql.CreateParameter(cmd, "@TABLE_NAME"      , "string",  30);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTE_ATTACHMENTS_Delete
		/// <summary>
		/// spNOTE_ATTACHMENTS_Delete
		/// </summary>
		public static void spNOTE_ATTACHMENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTE_ATTACHMENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTE_ATTACHMENTS_Delete
		/// <summary>
		/// spNOTE_ATTACHMENTS_Delete
		/// </summary>
		public static void spNOTE_ATTACHMENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTE_ATTACHMENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdNOTE_ATTACHMENTS_Delete
		/// <summary>
		/// spNOTE_ATTACHMENTS_Delete
		/// </summary>
		public static IDbCommand cmdNOTE_ATTACHMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTE_ATTACHMENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spNOTE_ATTACHMENTS_Insert
		/// <summary>
		/// spNOTE_ATTACHMENTS_Insert
		/// </summary>
		public static void spNOTE_ATTACHMENTS_Insert(ref Guid gID, Guid gNOTE_ID, string sDESCRIPTION, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTE_ATTACHMENTS_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNOTE_ID          = Sql.AddParameter(cmd, "@NOTE_ID"         , gNOTE_ID           );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       , 255);
							IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
							IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
							IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTE_ATTACHMENTS_Insert
		/// <summary>
		/// spNOTE_ATTACHMENTS_Insert
		/// </summary>
		public static void spNOTE_ATTACHMENTS_Insert(ref Guid gID, Guid gNOTE_ID, string sDESCRIPTION, string sFILENAME, string sFILE_EXT, string sFILE_MIME_TYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTE_ATTACHMENTS_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNOTE_ID          = Sql.AddParameter(cmd, "@NOTE_ID"         , gNOTE_ID           );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       , 255);
				IDbDataParameter parFILENAME         = Sql.AddParameter(cmd, "@FILENAME"        , sFILENAME          , 255);
				IDbDataParameter parFILE_EXT         = Sql.AddParameter(cmd, "@FILE_EXT"        , sFILE_EXT          ,  25);
				IDbDataParameter parFILE_MIME_TYPE   = Sql.AddParameter(cmd, "@FILE_MIME_TYPE"  , sFILE_MIME_TYPE    , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdNOTE_ATTACHMENTS_Insert
		/// <summary>
		/// spNOTE_ATTACHMENTS_Insert
		/// </summary>
		public static IDbCommand cmdNOTE_ATTACHMENTS_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTE_ATTACHMENTS_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNOTE_ID          = Sql.CreateParameter(cmd, "@NOTE_ID"         , "Guid",  16);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 255);
			IDbDataParameter parFILENAME         = Sql.CreateParameter(cmd, "@FILENAME"        , "string", 255);
			IDbDataParameter parFILE_EXT         = Sql.CreateParameter(cmd, "@FILE_EXT"        , "string",  25);
			IDbDataParameter parFILE_MIME_TYPE   = Sql.CreateParameter(cmd, "@FILE_MIME_TYPE"  , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTES_ATTACHMENT_InitPointer
		/// <summary>
		/// spNOTES_ATTACHMENT_InitPointer
		/// </summary>
		public static void spNOTES_ATTACHMENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_ATTACHMENT_InitPointer";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							parFILE_POINTER.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_ATTACHMENT_InitPointer
		/// <summary>
		/// spNOTES_ATTACHMENT_InitPointer
		/// </summary>
		public static void spNOTES_ATTACHMENT_InitPointer(Guid gID, ref byte[] binFILE_POINTER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_ATTACHMENT_InitPointer";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				parFILE_POINTER.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
			}
		}
		#endregion

		#region cmdNOTES_ATTACHMENT_InitPointer
		/// <summary>
		/// spNOTES_ATTACHMENT_InitPointer
		/// </summary>
		public static IDbCommand cmdNOTES_ATTACHMENT_InitPointer(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_ATTACHMENT_InitPointer";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			parFILE_POINTER.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTES_ATTACHMENT_ReadOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_ReadOffset
		/// </summary>
		public static void spNOTES_ATTACHMENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_ATTACHMENT_ReadOffset";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
							IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
							IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
							parBYTES.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							byBYTES = Sql.ToBinary(parBYTES.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_ATTACHMENT_ReadOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_ReadOffset
		/// </summary>
		public static void spNOTES_ATTACHMENT_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_ATTACHMENT_ReadOffset";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
				IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
				IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
				parBYTES.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				byBYTES = Sql.ToBinary(parBYTES.Value);
			}
		}
		#endregion

		#region cmdNOTES_ATTACHMENT_ReadOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_ReadOffset
		/// </summary>
		public static IDbCommand cmdNOTES_ATTACHMENT_ReadOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_ATTACHMENT_ReadOffset";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parFILE_OFFSET = Sql.CreateParameter(cmd, "@FILE_OFFSET", "Int32",   4);
			IDbDataParameter parREAD_SIZE   = Sql.CreateParameter(cmd, "@READ_SIZE"  , "Int32",   4);
			IDbDataParameter parBYTES       = Sql.CreateParameter(cmd, "@BYTES"      , "byte[]",  16);
			parBYTES.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTES_ATTACHMENT_WriteOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_WriteOffset
		/// </summary>
		public static void spNOTES_ATTACHMENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_ATTACHMENT_WriteOffset";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
							IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_ATTACHMENT_WriteOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_WriteOffset
		/// </summary>
		public static void spNOTES_ATTACHMENT_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_ATTACHMENT_WriteOffset";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
				IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdNOTES_ATTACHMENT_WriteOffset
		/// <summary>
		/// spNOTES_ATTACHMENT_WriteOffset
		/// </summary>
		public static IDbCommand cmdNOTES_ATTACHMENT_WriteOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_ATTACHMENT_WriteOffset";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_OFFSET      = Sql.CreateParameter(cmd, "@FILE_OFFSET"     , "Int32",   4);
			IDbDataParameter parBYTES            = Sql.CreateParameter(cmd, "@BYTES"           , "byte[]",  16);
			return cmd;
		}
		#endregion

		#region spNOTES_Copy
		/// <summary>
		/// spNOTES_Copy
		/// </summary>
		public static void spNOTES_Copy(ref Guid gID, Guid gCOPY_ID, string sPARENT_TYPE, Guid gPARENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_Copy";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parCOPY_ID          = Sql.AddParameter(cmd, "@COPY_ID"         , gCOPY_ID           );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_Copy
		/// <summary>
		/// spNOTES_Copy
		/// </summary>
		public static void spNOTES_Copy(ref Guid gID, Guid gCOPY_ID, string sPARENT_TYPE, Guid gPARENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_Copy";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parCOPY_ID          = Sql.AddParameter(cmd, "@COPY_ID"         , gCOPY_ID           );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdNOTES_Copy
		/// <summary>
		/// spNOTES_Copy
		/// </summary>
		public static IDbCommand cmdNOTES_Copy(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_Copy";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parCOPY_ID          = Sql.CreateParameter(cmd, "@COPY_ID"         , "Guid",  16);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTES_Delete
		/// <summary>
		/// spNOTES_Delete
		/// </summary>
		public static void spNOTES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_Delete
		/// <summary>
		/// spNOTES_Delete
		/// </summary>
		public static void spNOTES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdNOTES_Delete
		/// <summary>
		/// spNOTES_Delete
		/// </summary>
		public static IDbCommand cmdNOTES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spNOTES_MassDelete
		/// <summary>
		/// spNOTES_MassDelete
		/// </summary>
		public static void spNOTES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_MassDelete
		/// <summary>
		/// spNOTES_MassDelete
		/// </summary>
		public static void spNOTES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdNOTES_MassDelete
		/// <summary>
		/// spNOTES_MassDelete
		/// </summary>
		public static IDbCommand cmdNOTES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spNOTES_MassUpdate
		/// <summary>
		/// spNOTES_MassUpdate
		/// </summary>
		public static void spNOTES_MassUpdate(string sID_LIST, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_MassUpdate
		/// <summary>
		/// spNOTES_MassUpdate
		/// </summary>
		public static void spNOTES_MassUpdate(string sID_LIST, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdNOTES_MassUpdate
		/// <summary>
		/// spNOTES_MassUpdate
		/// </summary>
		public static IDbCommand cmdNOTES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spNOTES_New
		/// <summary>
		/// spNOTES_New
		/// </summary>
		public static void spNOTES_New(ref Guid gID, string sNAME, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_New
		/// <summary>
		/// spNOTES_New
		/// </summary>
		public static void spNOTES_New(ref Guid gID, string sNAME, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdNOTES_New
		/// <summary>
		/// spNOTES_New
		/// </summary>
		public static IDbCommand cmdNOTES_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spNOTES_Update
		/// <summary>
		/// spNOTES_Update
		/// </summary>
		public static void spNOTES_Update(ref Guid gID, string sNAME, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spNOTES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spNOTES_Update
		/// <summary>
		/// spNOTES_Update
		/// </summary>
		public static void spNOTES_Update(ref Guid gID, string sNAME, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spNOTES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdNOTES_Update
		/// <summary>
		/// spNOTES_Update
		/// </summary>
		public static IDbCommand cmdNOTES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spNOTES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_CONTACTS_Delete
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Delete
		/// </summary>
		public static void spOPPORTUNITIES_CONTACTS_Delete(Guid gOPPORTUNITY_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delet";
							else
								cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_CONTACTS_Delete
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Delete
		/// </summary>
		public static void spOPPORTUNITIES_CONTACTS_Delete(Guid gOPPORTUNITY_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delet";
				else
					cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_CONTACTS_Delete
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delet";
			else
				cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_CONTACTS_Update
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Update
		/// </summary>
		public static void spOPPORTUNITIES_CONTACTS_Update(Guid gOPPORTUNITY_ID, Guid gCONTACT_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Updat";
							else
								cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_CONTACTS_Update
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Update
		/// </summary>
		public static void spOPPORTUNITIES_CONTACTS_Update(Guid gOPPORTUNITY_ID, Guid gCONTACT_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Updat";
				else
					cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_CONTACTS_Update
		/// <summary>
		/// spOPPORTUNITIES_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Updat";
			else
				cmd.CommandText = "spOPPORTUNITIES_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  50);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_Delete
		/// <summary>
		/// spOPPORTUNITIES_Delete
		/// </summary>
		public static void spOPPORTUNITIES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_Delete
		/// <summary>
		/// spOPPORTUNITIES_Delete
		/// </summary>
		public static void spOPPORTUNITIES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_Delete
		/// <summary>
		/// spOPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_MassDelete
		/// <summary>
		/// spOPPORTUNITIES_MassDelete
		/// </summary>
		public static void spOPPORTUNITIES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_MassDelete
		/// <summary>
		/// spOPPORTUNITIES_MassDelete
		/// </summary>
		public static void spOPPORTUNITIES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_MassDelete
		/// <summary>
		/// spOPPORTUNITIES_MassDelete
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_MassUpdate
		/// <summary>
		/// spOPPORTUNITIES_MassUpdate
		/// </summary>
		public static void spOPPORTUNITIES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sOPPORTUNITY_TYPE, string sLEAD_SOURCE, DateTime dtDATE_CLOSED, string sSALES_STAGE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parOPPORTUNITY_TYPE = Sql.AddParameter(cmd, "@OPPORTUNITY_TYPE", sOPPORTUNITY_TYPE  ,  25);
							IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       ,  25);
							IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
							IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_MassUpdate
		/// <summary>
		/// spOPPORTUNITIES_MassUpdate
		/// </summary>
		public static void spOPPORTUNITIES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sOPPORTUNITY_TYPE, string sLEAD_SOURCE, DateTime dtDATE_CLOSED, string sSALES_STAGE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parOPPORTUNITY_TYPE = Sql.AddParameter(cmd, "@OPPORTUNITY_TYPE", sOPPORTUNITY_TYPE  ,  25);
				IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       ,  25);
				IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
				IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_MassUpdate
		/// <summary>
		/// spOPPORTUNITIES_MassUpdate
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_TYPE = Sql.CreateParameter(cmd, "@OPPORTUNITY_TYPE", "string",  25);
			IDbDataParameter parLEAD_SOURCE      = Sql.CreateParameter(cmd, "@LEAD_SOURCE"     , "string",  25);
			IDbDataParameter parDATE_CLOSED      = Sql.CreateParameter(cmd, "@DATE_CLOSED"     , "DateTime",   8);
			IDbDataParameter parSALES_STAGE      = Sql.CreateParameter(cmd, "@SALES_STAGE"     , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_New
		/// <summary>
		/// spOPPORTUNITIES_New
		/// </summary>
		public static void spOPPORTUNITIES_New(ref Guid gID, Guid gACCOUNT_ID, string sNAME, decimal dAMOUNT, Guid gCURRENCY_ID, DateTime dtDATE_CLOSED, string sSALES_STAGE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
							IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
							IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
							IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_New
		/// <summary>
		/// spOPPORTUNITIES_New
		/// </summary>
		public static void spOPPORTUNITIES_New(ref Guid gID, Guid gACCOUNT_ID, string sNAME, decimal dAMOUNT, Guid gCURRENCY_ID, DateTime dtDATE_CLOSED, string sSALES_STAGE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
				IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
				IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
				IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_New
		/// <summary>
		/// spOPPORTUNITIES_New
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parAMOUNT           = Sql.CreateParameter(cmd, "@AMOUNT"          , "decimal",   8);
			IDbDataParameter parCURRENCY_ID      = Sql.CreateParameter(cmd, "@CURRENCY_ID"     , "Guid",  16);
			IDbDataParameter parDATE_CLOSED      = Sql.CreateParameter(cmd, "@DATE_CLOSED"     , "DateTime",   8);
			IDbDataParameter parSALES_STAGE      = Sql.CreateParameter(cmd, "@SALES_STAGE"     , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_THREADS_Delete
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Delete
		/// </summary>
		public static void spOPPORTUNITIES_THREADS_Delete(Guid gOPPORTUNITY_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_THREADS_Delete
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Delete
		/// </summary>
		public static void spOPPORTUNITIES_THREADS_Delete(Guid gOPPORTUNITY_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_THREADS_Delete
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_THREADS_Update
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Update
		/// </summary>
		public static void spOPPORTUNITIES_THREADS_Update(Guid gOPPORTUNITY_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_THREADS_Update
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Update
		/// </summary>
		public static void spOPPORTUNITIES_THREADS_Update(Guid gOPPORTUNITY_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_THREADS_Update
		/// <summary>
		/// spOPPORTUNITIES_THREADS_Update
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spOPPORTUNITIES_Update
		/// <summary>
		/// spOPPORTUNITIES_Update
		/// </summary>
		public static void spOPPORTUNITIES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sNAME, string sOPPORTUNITY_TYPE, string sLEAD_SOURCE, decimal dAMOUNT, Guid gCURRENCY_ID, DateTime dtDATE_CLOSED, string sNEXT_STEP, string sSALES_STAGE, float flPROBABILITY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, string sACCOUNT_NAME, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spOPPORTUNITIES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parOPPORTUNITY_TYPE = Sql.AddParameter(cmd, "@OPPORTUNITY_TYPE", sOPPORTUNITY_TYPE  , 255);
							IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       ,  50);
							IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
							IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
							IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
							IDbDataParameter parNEXT_STEP        = Sql.AddParameter(cmd, "@NEXT_STEP"       , sNEXT_STEP         , 100);
							IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
							IDbDataParameter parPROBABILITY      = Sql.AddParameter(cmd, "@PROBABILITY"     , flPROBABILITY      );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spOPPORTUNITIES_Update
		/// <summary>
		/// spOPPORTUNITIES_Update
		/// </summary>
		public static void spOPPORTUNITIES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, string sNAME, string sOPPORTUNITY_TYPE, string sLEAD_SOURCE, decimal dAMOUNT, Guid gCURRENCY_ID, DateTime dtDATE_CLOSED, string sNEXT_STEP, string sSALES_STAGE, float flPROBABILITY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, string sACCOUNT_NAME, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spOPPORTUNITIES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parOPPORTUNITY_TYPE = Sql.AddParameter(cmd, "@OPPORTUNITY_TYPE", sOPPORTUNITY_TYPE  , 255);
				IDbDataParameter parLEAD_SOURCE      = Sql.AddParameter(cmd, "@LEAD_SOURCE"     , sLEAD_SOURCE       ,  50);
				IDbDataParameter parAMOUNT           = Sql.AddParameter(cmd, "@AMOUNT"          , dAMOUNT            );
				IDbDataParameter parCURRENCY_ID      = Sql.AddParameter(cmd, "@CURRENCY_ID"     , gCURRENCY_ID       );
				IDbDataParameter parDATE_CLOSED      = Sql.AddParameter(cmd, "@DATE_CLOSED"     , dtDATE_CLOSED      );
				IDbDataParameter parNEXT_STEP        = Sql.AddParameter(cmd, "@NEXT_STEP"       , sNEXT_STEP         , 100);
				IDbDataParameter parSALES_STAGE      = Sql.AddParameter(cmd, "@SALES_STAGE"     , sSALES_STAGE       ,  25);
				IDbDataParameter parPROBABILITY      = Sql.AddParameter(cmd, "@PROBABILITY"     , flPROBABILITY      );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parACCOUNT_NAME     = Sql.AddParameter(cmd, "@ACCOUNT_NAME"    , sACCOUNT_NAME      , 100);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdOPPORTUNITIES_Update
		/// <summary>
		/// spOPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdOPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spOPPORTUNITIES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parOPPORTUNITY_TYPE = Sql.CreateParameter(cmd, "@OPPORTUNITY_TYPE", "string", 255);
			IDbDataParameter parLEAD_SOURCE      = Sql.CreateParameter(cmd, "@LEAD_SOURCE"     , "string",  50);
			IDbDataParameter parAMOUNT           = Sql.CreateParameter(cmd, "@AMOUNT"          , "decimal",   8);
			IDbDataParameter parCURRENCY_ID      = Sql.CreateParameter(cmd, "@CURRENCY_ID"     , "Guid",  16);
			IDbDataParameter parDATE_CLOSED      = Sql.CreateParameter(cmd, "@DATE_CLOSED"     , "DateTime",   8);
			IDbDataParameter parNEXT_STEP        = Sql.CreateParameter(cmd, "@NEXT_STEP"       , "string", 100);
			IDbDataParameter parSALES_STAGE      = Sql.CreateParameter(cmd, "@SALES_STAGE"     , "string",  25);
			IDbDataParameter parPROBABILITY      = Sql.CreateParameter(cmd, "@PROBABILITY"     , "float",   8);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parACCOUNT_NAME     = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"    , "string", 100);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spORDERS_ACCOUNTS_Delete
		/// <summary>
		/// spORDERS_ACCOUNTS_Delete
		/// </summary>
		public static void spORDERS_ACCOUNTS_Delete(Guid gORDER_ID, Guid gACCOUNT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_ACCOUNTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_ACCOUNTS_Delete
		/// <summary>
		/// spORDERS_ACCOUNTS_Delete
		/// </summary>
		public static void spORDERS_ACCOUNTS_Delete(Guid gORDER_ID, Guid gACCOUNT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_ACCOUNTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_ACCOUNTS_Delete
		/// <summary>
		/// spORDERS_ACCOUNTS_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_ACCOUNTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_ACCOUNTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_ACCOUNTS_Update
		/// <summary>
		/// spORDERS_ACCOUNTS_Update
		/// </summary>
		public static void spORDERS_ACCOUNTS_Update(Guid gORDER_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_ACCOUNTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_ACCOUNTS_Update
		/// <summary>
		/// spORDERS_ACCOUNTS_Update
		/// </summary>
		public static void spORDERS_ACCOUNTS_Update(Guid gORDER_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_ACCOUNTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_ACCOUNTS_Update
		/// <summary>
		/// spORDERS_ACCOUNTS_Update
		/// </summary>
		public static IDbCommand cmdORDERS_ACCOUNTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_ACCOUNTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parACCOUNT_ROLE     = Sql.CreateParameter(cmd, "@ACCOUNT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spORDERS_CONTACTS_Delete
		/// <summary>
		/// spORDERS_CONTACTS_Delete
		/// </summary>
		public static void spORDERS_CONTACTS_Delete(Guid gORDER_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_CONTACTS_Delete
		/// <summary>
		/// spORDERS_CONTACTS_Delete
		/// </summary>
		public static void spORDERS_CONTACTS_Delete(Guid gORDER_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_CONTACTS_Delete
		/// <summary>
		/// spORDERS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_CONTACTS_Update
		/// <summary>
		/// spORDERS_CONTACTS_Update
		/// </summary>
		public static void spORDERS_CONTACTS_Update(Guid gORDER_ID, Guid gCONTACT_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_CONTACTS_Update
		/// <summary>
		/// spORDERS_CONTACTS_Update
		/// </summary>
		public static void spORDERS_CONTACTS_Update(Guid gORDER_ID, Guid gCONTACT_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_CONTACTS_Update
		/// <summary>
		/// spORDERS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdORDERS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spORDERS_Delete
		/// <summary>
		/// spORDERS_Delete
		/// </summary>
		public static void spORDERS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_Delete
		/// <summary>
		/// spORDERS_Delete
		/// </summary>
		public static void spORDERS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_Delete
		/// <summary>
		/// spORDERS_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_ITEMS_Delete
		/// <summary>
		/// spORDERS_ITEMS_Delete
		/// </summary>
		public static void spORDERS_ITEMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_ITEMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_ITEMS_Delete
		/// <summary>
		/// spORDERS_ITEMS_Delete
		/// </summary>
		public static void spORDERS_ITEMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_ITEMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_ITEMS_Delete
		/// <summary>
		/// spORDERS_ITEMS_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_ITEMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_ITEMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_ITEMS_LineItemUpdate
		/// <summary>
		/// spORDERS_ITEMS_LineItemUpdate
		/// </summary>
		public static void spORDERS_ITEMS_LineItemUpdate(ref Guid gID, Guid gORDER_ID, Guid gPRODUCT_TEMPLATE_ID, Int32 nITEM_SEQUENCE, string sMFT_PART_NUM, string sDESCRIPTION, Int32 nQUANTITY, decimal dUNIT_PRICE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_ITEMS_LineItemUpdate";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parORDER_ID            = Sql.AddParameter(cmd, "@ORDER_ID"           , gORDER_ID             );
							IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
							IDbDataParameter parITEM_SEQUENCE       = Sql.AddParameter(cmd, "@ITEM_SEQUENCE"      , nITEM_SEQUENCE        );
							IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          , 255);
							IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
							IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_ITEMS_LineItemUpdate
		/// <summary>
		/// spORDERS_ITEMS_LineItemUpdate
		/// </summary>
		public static void spORDERS_ITEMS_LineItemUpdate(ref Guid gID, Guid gORDER_ID, Guid gPRODUCT_TEMPLATE_ID, Int32 nITEM_SEQUENCE, string sMFT_PART_NUM, string sDESCRIPTION, Int32 nQUANTITY, decimal dUNIT_PRICE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_ITEMS_LineItemUpdate";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parORDER_ID            = Sql.AddParameter(cmd, "@ORDER_ID"           , gORDER_ID             );
				IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
				IDbDataParameter parITEM_SEQUENCE       = Sql.AddParameter(cmd, "@ITEM_SEQUENCE"      , nITEM_SEQUENCE        );
				IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          , 255);
				IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
				IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdORDERS_ITEMS_LineItemUpdate
		/// <summary>
		/// spORDERS_ITEMS_LineItemUpdate
		/// </summary>
		public static IDbCommand cmdORDERS_ITEMS_LineItemUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_ITEMS_LineItemUpdate";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parORDER_ID            = Sql.CreateParameter(cmd, "@ORDER_ID"           , "Guid",  16);
			IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.CreateParameter(cmd, "@PRODUCT_TEMPLATE_ID", "Guid",  16);
			IDbDataParameter parITEM_SEQUENCE       = Sql.CreateParameter(cmd, "@ITEM_SEQUENCE"      , "Int32",   4);
			IDbDataParameter parMFT_PART_NUM        = Sql.CreateParameter(cmd, "@MFT_PART_NUM"       , "string",  50);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 255);
			IDbDataParameter parQUANTITY            = Sql.CreateParameter(cmd, "@QUANTITY"           , "Int32",   4);
			IDbDataParameter parUNIT_PRICE          = Sql.CreateParameter(cmd, "@UNIT_PRICE"         , "decimal",   8);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spORDERS_LINE_ITEMS_Delete
		/// <summary>
		/// spORDERS_LINE_ITEMS_Delete
		/// </summary>
		public static void spORDERS_LINE_ITEMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_LINE_ITEMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_LINE_ITEMS_Delete
		/// <summary>
		/// spORDERS_LINE_ITEMS_Delete
		/// </summary>
		public static void spORDERS_LINE_ITEMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_LINE_ITEMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_LINE_ITEMS_Delete
		/// <summary>
		/// spORDERS_LINE_ITEMS_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_LINE_ITEMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_LINE_ITEMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_LINE_ITEMS_Update
		/// <summary>
		/// spORDERS_LINE_ITEMS_Update
		/// </summary>
		public static void spORDERS_LINE_ITEMS_Update(ref Guid gID, Guid gORDER_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_LINE_ITEMS_Update";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parORDER_ID            = Sql.AddParameter(cmd, "@ORDER_ID"           , gORDER_ID             );
							IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
							IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
							IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
							IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
							IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
							IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
							IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
							IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
							IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
							IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
							IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
							IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_LINE_ITEMS_Update
		/// <summary>
		/// spORDERS_LINE_ITEMS_Update
		/// </summary>
		public static void spORDERS_LINE_ITEMS_Update(ref Guid gID, Guid gORDER_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_LINE_ITEMS_Update";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parORDER_ID            = Sql.AddParameter(cmd, "@ORDER_ID"           , gORDER_ID             );
				IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
				IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
				IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
				IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
				IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
				IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
				IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
				IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
				IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
				IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
				IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
				IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdORDERS_LINE_ITEMS_Update
		/// <summary>
		/// spORDERS_LINE_ITEMS_Update
		/// </summary>
		public static IDbCommand cmdORDERS_LINE_ITEMS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_LINE_ITEMS_Update";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parORDER_ID            = Sql.CreateParameter(cmd, "@ORDER_ID"           , "Guid",  16);
			IDbDataParameter parLINE_GROUP_ID       = Sql.CreateParameter(cmd, "@LINE_GROUP_ID"      , "Guid",  16);
			IDbDataParameter parLINE_ITEM_TYPE      = Sql.CreateParameter(cmd, "@LINE_ITEM_TYPE"     , "string",  25);
			IDbDataParameter parPOSITION            = Sql.CreateParameter(cmd, "@POSITION"           , "Int32",   4);
			IDbDataParameter parNAME                = Sql.CreateParameter(cmd, "@NAME"               , "string", 100);
			IDbDataParameter parMFT_PART_NUM        = Sql.CreateParameter(cmd, "@MFT_PART_NUM"       , "string",  50);
			IDbDataParameter parVENDOR_PART_NUM     = Sql.CreateParameter(cmd, "@VENDOR_PART_NUM"    , "string",  50);
			IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.CreateParameter(cmd, "@PRODUCT_TEMPLATE_ID", "Guid",  16);
			IDbDataParameter parTAX_CLASS           = Sql.CreateParameter(cmd, "@TAX_CLASS"          , "string",  25);
			IDbDataParameter parQUANTITY            = Sql.CreateParameter(cmd, "@QUANTITY"           , "Int32",   4);
			IDbDataParameter parCOST_PRICE          = Sql.CreateParameter(cmd, "@COST_PRICE"         , "decimal",   8);
			IDbDataParameter parLIST_PRICE          = Sql.CreateParameter(cmd, "@LIST_PRICE"         , "decimal",   8);
			IDbDataParameter parUNIT_PRICE          = Sql.CreateParameter(cmd, "@UNIT_PRICE"         , "decimal",   8);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spORDERS_MassDelete
		/// <summary>
		/// spORDERS_MassDelete
		/// </summary>
		public static void spORDERS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_MassDelete
		/// <summary>
		/// spORDERS_MassDelete
		/// </summary>
		public static void spORDERS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_MassDelete
		/// <summary>
		/// spORDERS_MassDelete
		/// </summary>
		public static IDbCommand cmdORDERS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_MassUpdate
		/// <summary>
		/// spORDERS_MassUpdate
		/// </summary>
		public static void spORDERS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sORDER_STAGE, DateTime dtDATE_ORDER_DUE, DateTime dtDATE_ORDER_SHIPPED, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_MassUpdate";
							IDbDataParameter parID_LIST            = Sql.AddAnsiParam(cmd, "@ID_LIST"           , sID_LIST             , 8000);
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
							IDbDataParameter parPAYMENT_TERMS      = Sql.AddParameter(cmd, "@PAYMENT_TERMS"     , sPAYMENT_TERMS       ,  25);
							IDbDataParameter parORDER_STAGE        = Sql.AddParameter(cmd, "@ORDER_STAGE"       , sORDER_STAGE         ,  25);
							IDbDataParameter parDATE_ORDER_DUE     = Sql.AddParameter(cmd, "@DATE_ORDER_DUE"    , dtDATE_ORDER_DUE     );
							IDbDataParameter parDATE_ORDER_SHIPPED = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED", dtDATE_ORDER_SHIPPED );
							IDbDataParameter parTEAM_ID            = Sql.AddParameter(cmd, "@TEAM_ID"           , gTEAM_ID             );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_MassUpdate
		/// <summary>
		/// spORDERS_MassUpdate
		/// </summary>
		public static void spORDERS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sORDER_STAGE, DateTime dtDATE_ORDER_DUE, DateTime dtDATE_ORDER_SHIPPED, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_MassUpdate";
				IDbDataParameter parID_LIST            = Sql.AddAnsiParam(cmd, "@ID_LIST"           , sID_LIST             , 8000);
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
				IDbDataParameter parPAYMENT_TERMS      = Sql.AddParameter(cmd, "@PAYMENT_TERMS"     , sPAYMENT_TERMS       ,  25);
				IDbDataParameter parORDER_STAGE        = Sql.AddParameter(cmd, "@ORDER_STAGE"       , sORDER_STAGE         ,  25);
				IDbDataParameter parDATE_ORDER_DUE     = Sql.AddParameter(cmd, "@DATE_ORDER_DUE"    , dtDATE_ORDER_DUE     );
				IDbDataParameter parDATE_ORDER_SHIPPED = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED", dtDATE_ORDER_SHIPPED );
				IDbDataParameter parTEAM_ID            = Sql.AddParameter(cmd, "@TEAM_ID"           , gTEAM_ID             );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_MassUpdate
		/// <summary>
		/// spORDERS_MassUpdate
		/// </summary>
		public static IDbCommand cmdORDERS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_MassUpdate";
			IDbDataParameter parID_LIST            = Sql.CreateParameter(cmd, "@ID_LIST"           , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID   = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"  , "Guid",  16);
			IDbDataParameter parPAYMENT_TERMS      = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"     , "string",  25);
			IDbDataParameter parORDER_STAGE        = Sql.CreateParameter(cmd, "@ORDER_STAGE"       , "string",  25);
			IDbDataParameter parDATE_ORDER_DUE     = Sql.CreateParameter(cmd, "@DATE_ORDER_DUE"    , "DateTime",   8);
			IDbDataParameter parDATE_ORDER_SHIPPED = Sql.CreateParameter(cmd, "@DATE_ORDER_SHIPPED", "DateTime",   8);
			IDbDataParameter parTEAM_ID            = Sql.CreateParameter(cmd, "@TEAM_ID"           , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_OPPORTUNITIES_Delete
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spORDERS_OPPORTUNITIES_Delete(Guid gORDER_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_OPPORTUNITIES_Delete
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Delete
		/// </summary>
		public static void spORDERS_OPPORTUNITIES_Delete(Guid gORDER_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_OPPORTUNITIES_Delete
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdORDERS_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_OPPORTUNITIES_Update
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Update
		/// </summary>
		public static void spORDERS_OPPORTUNITIES_Update(Guid gORDER_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_OPPORTUNITIES_Update
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Update
		/// </summary>
		public static void spORDERS_OPPORTUNITIES_Update(Guid gORDER_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parORDER_ID         = Sql.AddParameter(cmd, "@ORDER_ID"        , gORDER_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_OPPORTUNITIES_Update
		/// <summary>
		/// spORDERS_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdORDERS_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parORDER_ID         = Sql.CreateParameter(cmd, "@ORDER_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spORDERS_Update
		/// <summary>
		/// spORDERS_Update
		/// </summary>
		public static void spORDERS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gQUOTE_ID, Guid gOPPORTUNITY_ID, string sPAYMENT_TERMS, string sORDER_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_ORDER_DUE, DateTime dtDATE_ORDER_SHIPPED, bool bSHOW_LINE_NUMS, bool bCALC_GRAND_TOTAL, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_Update";
							IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
							IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
							IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
							IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         ,  50);
							IDbDataParameter parQUOTE_ID                    = Sql.AddParameter(cmd, "@QUOTE_ID"                   , gQUOTE_ID                     );
							IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
							IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
							IDbDataParameter parORDER_STAGE                 = Sql.AddParameter(cmd, "@ORDER_STAGE"                , sORDER_STAGE                  ,  25);
							IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
							IDbDataParameter parORIGINAL_PO_DATE            = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"           , dtORIGINAL_PO_DATE            );
							IDbDataParameter parDATE_ORDER_DUE              = Sql.AddParameter(cmd, "@DATE_ORDER_DUE"             , dtDATE_ORDER_DUE              );
							IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED"         , dtDATE_ORDER_SHIPPED          );
							IDbDataParameter parSHOW_LINE_NUMS              = Sql.AddParameter(cmd, "@SHOW_LINE_NUMS"             , bSHOW_LINE_NUMS               );
							IDbDataParameter parCALC_GRAND_TOTAL            = Sql.AddParameter(cmd, "@CALC_GRAND_TOTAL"           , bCALC_GRAND_TOTAL             );
							IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
							IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
							IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
							IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
							IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
							IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
							IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
							IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
							IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
							IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
							IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
							IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
							IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
							IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
							IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
							IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
							IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
							IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
							IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
							IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
							IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
							IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
							IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_Update
		/// <summary>
		/// spORDERS_Update
		/// </summary>
		public static void spORDERS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gQUOTE_ID, Guid gOPPORTUNITY_ID, string sPAYMENT_TERMS, string sORDER_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_ORDER_DUE, DateTime dtDATE_ORDER_SHIPPED, bool bSHOW_LINE_NUMS, bool bCALC_GRAND_TOTAL, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_Update";
				IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
				IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
				IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
				IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         ,  50);
				IDbDataParameter parQUOTE_ID                    = Sql.AddParameter(cmd, "@QUOTE_ID"                   , gQUOTE_ID                     );
				IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
				IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
				IDbDataParameter parORDER_STAGE                 = Sql.AddParameter(cmd, "@ORDER_STAGE"                , sORDER_STAGE                  ,  25);
				IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
				IDbDataParameter parORIGINAL_PO_DATE            = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"           , dtORIGINAL_PO_DATE            );
				IDbDataParameter parDATE_ORDER_DUE              = Sql.AddParameter(cmd, "@DATE_ORDER_DUE"             , dtDATE_ORDER_DUE              );
				IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED"         , dtDATE_ORDER_SHIPPED          );
				IDbDataParameter parSHOW_LINE_NUMS              = Sql.AddParameter(cmd, "@SHOW_LINE_NUMS"             , bSHOW_LINE_NUMS               );
				IDbDataParameter parCALC_GRAND_TOTAL            = Sql.AddParameter(cmd, "@CALC_GRAND_TOTAL"           , bCALC_GRAND_TOTAL             );
				IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
				IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
				IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
				IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
				IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
				IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
				IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
				IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
				IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
				IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
				IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
				IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
				IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
				IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
				IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
				IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
				IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
				IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
				IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
				IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
				IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
				IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
				IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdORDERS_Update
		/// <summary>
		/// spORDERS_Update
		/// </summary>
		public static IDbCommand cmdORDERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_Update";
			IDbDataParameter parID                          = Sql.CreateParameter(cmd, "@ID"                         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID            = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"           , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID            = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"           , "Guid",  16);
			IDbDataParameter parNAME                        = Sql.CreateParameter(cmd, "@NAME"                       , "string",  50);
			IDbDataParameter parQUOTE_ID                    = Sql.CreateParameter(cmd, "@QUOTE_ID"                   , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID              = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"             , "Guid",  16);
			IDbDataParameter parPAYMENT_TERMS               = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"              , "string",  25);
			IDbDataParameter parORDER_STAGE                 = Sql.CreateParameter(cmd, "@ORDER_STAGE"                , "string",  25);
			IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.CreateParameter(cmd, "@PURCHASE_ORDER_NUM"         , "string",  50);
			IDbDataParameter parORIGINAL_PO_DATE            = Sql.CreateParameter(cmd, "@ORIGINAL_PO_DATE"           , "DateTime",   8);
			IDbDataParameter parDATE_ORDER_DUE              = Sql.CreateParameter(cmd, "@DATE_ORDER_DUE"             , "DateTime",   8);
			IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.CreateParameter(cmd, "@DATE_ORDER_SHIPPED"         , "DateTime",   8);
			IDbDataParameter parSHOW_LINE_NUMS              = Sql.CreateParameter(cmd, "@SHOW_LINE_NUMS"             , "bool",   1);
			IDbDataParameter parCALC_GRAND_TOTAL            = Sql.CreateParameter(cmd, "@CALC_GRAND_TOTAL"           , "bool",   1);
			IDbDataParameter parEXCHANGE_RATE               = Sql.CreateParameter(cmd, "@EXCHANGE_RATE"              , "float",   8);
			IDbDataParameter parCURRENCY_ID                 = Sql.CreateParameter(cmd, "@CURRENCY_ID"                , "Guid",  16);
			IDbDataParameter parTAXRATE_ID                  = Sql.CreateParameter(cmd, "@TAXRATE_ID"                 , "Guid",  16);
			IDbDataParameter parSHIPPER_ID                  = Sql.CreateParameter(cmd, "@SHIPPER_ID"                 , "Guid",  16);
			IDbDataParameter parSUBTOTAL                    = Sql.CreateParameter(cmd, "@SUBTOTAL"                   , "decimal",   8);
			IDbDataParameter parDISCOUNT                    = Sql.CreateParameter(cmd, "@DISCOUNT"                   , "decimal",   8);
			IDbDataParameter parSHIPPING                    = Sql.CreateParameter(cmd, "@SHIPPING"                   , "decimal",   8);
			IDbDataParameter parTAX                         = Sql.CreateParameter(cmd, "@TAX"                        , "decimal",   8);
			IDbDataParameter parTOTAL                       = Sql.CreateParameter(cmd, "@TOTAL"                      , "decimal",   8);
			IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.CreateParameter(cmd, "@BILLING_ACCOUNT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_CONTACT_ID          = Sql.CreateParameter(cmd, "@BILLING_CONTACT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STREET"     , "string", 150);
			IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_CITY"       , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STATE"      , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , "string",  20);
			IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , "string", 100);
			IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_CONTACT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parDESCRIPTION                 = Sql.CreateParameter(cmd, "@DESCRIPTION"                , "string", 104857600);
			IDbDataParameter parTEAM_ID                     = Sql.CreateParameter(cmd, "@TEAM_ID"                    , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spORDERS_UpdateTotals
		/// <summary>
		/// spORDERS_UpdateTotals
		/// </summary>
		public static void spORDERS_UpdateTotals(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spORDERS_UpdateTotals";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spORDERS_UpdateTotals
		/// <summary>
		/// spORDERS_UpdateTotals
		/// </summary>
		public static void spORDERS_UpdateTotals(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spORDERS_UpdateTotals";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdORDERS_UpdateTotals
		/// <summary>
		/// spORDERS_UpdateTotals
		/// </summary>
		public static IDbCommand cmdORDERS_UpdateTotals(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spORDERS_UpdateTotals";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPARENT_Delete
		/// <summary>
		/// spPARENT_Delete
		/// </summary>
		public static void spPARENT_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPARENT_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPARENT_Delete
		/// <summary>
		/// spPARENT_Delete
		/// </summary>
		public static void spPARENT_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPARENT_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPARENT_Delete
		/// <summary>
		/// spPARENT_Delete
		/// </summary>
		public static IDbCommand cmdPARENT_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPARENT_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPARENT_Get
		/// <summary>
		/// spPARENT_Get
		/// </summary>
		public static void spPARENT_Get(ref Guid gID, ref string sMODULE, ref string sPARENT_TYPE, ref string sPARENT_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPARENT_Get";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parMODULE      = Sql.AddParameter(cmd, "@MODULE"     , sMODULE       ,  25);
							IDbDataParameter parPARENT_TYPE = Sql.AddParameter(cmd, "@PARENT_TYPE", sPARENT_TYPE  ,  25);
							IDbDataParameter parPARENT_NAME = Sql.AddParameter(cmd, "@PARENT_NAME", sPARENT_NAME  , 150);
							parID.Direction = ParameterDirection.InputOutput;
							parMODULE.Direction = ParameterDirection.InputOutput;
							parPARENT_TYPE.Direction = ParameterDirection.InputOutput;
							parPARENT_NAME.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
							sMODULE = Sql.ToString(parMODULE.Value);
							sPARENT_TYPE = Sql.ToString(parPARENT_TYPE.Value);
							sPARENT_NAME = Sql.ToString(parPARENT_NAME.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPARENT_Get
		/// <summary>
		/// spPARENT_Get
		/// </summary>
		public static void spPARENT_Get(ref Guid gID, ref string sMODULE, ref string sPARENT_TYPE, ref string sPARENT_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPARENT_Get";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parMODULE      = Sql.AddParameter(cmd, "@MODULE"     , sMODULE       ,  25);
				IDbDataParameter parPARENT_TYPE = Sql.AddParameter(cmd, "@PARENT_TYPE", sPARENT_TYPE  ,  25);
				IDbDataParameter parPARENT_NAME = Sql.AddParameter(cmd, "@PARENT_NAME", sPARENT_NAME  , 150);
				parID.Direction = ParameterDirection.InputOutput;
				parMODULE.Direction = ParameterDirection.InputOutput;
				parPARENT_TYPE.Direction = ParameterDirection.InputOutput;
				parPARENT_NAME.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
				sMODULE = Sql.ToString(parMODULE.Value);
				sPARENT_TYPE = Sql.ToString(parPARENT_TYPE.Value);
				sPARENT_NAME = Sql.ToString(parPARENT_NAME.Value);
			}
		}
		#endregion

		#region cmdPARENT_Get
		/// <summary>
		/// spPARENT_Get
		/// </summary>
		public static IDbCommand cmdPARENT_Get(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPARENT_Get";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parMODULE      = Sql.CreateParameter(cmd, "@MODULE"     , "string",  25);
			IDbDataParameter parPARENT_TYPE = Sql.CreateParameter(cmd, "@PARENT_TYPE", "string",  25);
			IDbDataParameter parPARENT_NAME = Sql.CreateParameter(cmd, "@PARENT_NAME", "string", 150);
			parID.Direction = ParameterDirection.InputOutput;
			parMODULE.Direction = ParameterDirection.InputOutput;
			parPARENT_TYPE.Direction = ParameterDirection.InputOutput;
			parPARENT_NAME.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPAYMENTS_Delete
		/// <summary>
		/// spPAYMENTS_Delete
		/// </summary>
		public static void spPAYMENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPAYMENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPAYMENTS_Delete
		/// <summary>
		/// spPAYMENTS_Delete
		/// </summary>
		public static void spPAYMENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPAYMENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPAYMENTS_Delete
		/// <summary>
		/// spPAYMENTS_Delete
		/// </summary>
		public static IDbCommand cmdPAYMENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPAYMENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPAYMENTS_MassUpdate
		/// <summary>
		/// spPAYMENTS_MassUpdate
		/// </summary>
		public static void spPAYMENTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtPAYMENT_DATE, string sPAYMENT_TYPE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPAYMENTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parPAYMENT_DATE     = Sql.AddParameter(cmd, "@PAYMENT_DATE"    , dtPAYMENT_DATE     );
							IDbDataParameter parPAYMENT_TYPE     = Sql.AddParameter(cmd, "@PAYMENT_TYPE"    , sPAYMENT_TYPE      ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPAYMENTS_MassUpdate
		/// <summary>
		/// spPAYMENTS_MassUpdate
		/// </summary>
		public static void spPAYMENTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, DateTime dtPAYMENT_DATE, string sPAYMENT_TYPE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPAYMENTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parPAYMENT_DATE     = Sql.AddParameter(cmd, "@PAYMENT_DATE"    , dtPAYMENT_DATE     );
				IDbDataParameter parPAYMENT_TYPE     = Sql.AddParameter(cmd, "@PAYMENT_TYPE"    , sPAYMENT_TYPE      ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPAYMENTS_MassUpdate
		/// <summary>
		/// spPAYMENTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPAYMENTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPAYMENTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parPAYMENT_DATE     = Sql.CreateParameter(cmd, "@PAYMENT_DATE"    , "DateTime",   8);
			IDbDataParameter parPAYMENT_TYPE     = Sql.CreateParameter(cmd, "@PAYMENT_TYPE"    , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPAYMENTS_Update
		/// <summary>
		/// spPAYMENTS_Update
		/// </summary>
		public static void spPAYMENTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, DateTime dtPAYMENT_DATE, string sPAYMENT_TYPE, string sCUSTOMER_REFERENCE, float flEXCHANGE_RATE, Guid gCURRENCY_ID, decimal dAMOUNT, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPAYMENTS_Update";
							IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
							IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
							IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
							IDbDataParameter parACCOUNT_ID         = Sql.AddParameter(cmd, "@ACCOUNT_ID"        , gACCOUNT_ID          );
							IDbDataParameter parPAYMENT_DATE       = Sql.AddParameter(cmd, "@PAYMENT_DATE"      , dtPAYMENT_DATE       );
							IDbDataParameter parPAYMENT_TYPE       = Sql.AddParameter(cmd, "@PAYMENT_TYPE"      , sPAYMENT_TYPE        ,  25);
							IDbDataParameter parCUSTOMER_REFERENCE = Sql.AddParameter(cmd, "@CUSTOMER_REFERENCE", sCUSTOMER_REFERENCE  ,  50);
							IDbDataParameter parEXCHANGE_RATE      = Sql.AddParameter(cmd, "@EXCHANGE_RATE"     , flEXCHANGE_RATE      );
							IDbDataParameter parCURRENCY_ID        = Sql.AddParameter(cmd, "@CURRENCY_ID"       , gCURRENCY_ID         );
							IDbDataParameter parAMOUNT             = Sql.AddParameter(cmd, "@AMOUNT"            , dAMOUNT              );
							IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
							IDbDataParameter parTEAM_ID            = Sql.AddParameter(cmd, "@TEAM_ID"           , gTEAM_ID             );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPAYMENTS_Update
		/// <summary>
		/// spPAYMENTS_Update
		/// </summary>
		public static void spPAYMENTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, Guid gACCOUNT_ID, DateTime dtPAYMENT_DATE, string sPAYMENT_TYPE, string sCUSTOMER_REFERENCE, float flEXCHANGE_RATE, Guid gCURRENCY_ID, decimal dAMOUNT, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPAYMENTS_Update";
				IDbDataParameter parID                 = Sql.AddParameter(cmd, "@ID"                , gID                  );
				IDbDataParameter parMODIFIED_USER_ID   = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"  ,  Security.USER_ID    );
				IDbDataParameter parASSIGNED_USER_ID   = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"  , gASSIGNED_USER_ID    );
				IDbDataParameter parACCOUNT_ID         = Sql.AddParameter(cmd, "@ACCOUNT_ID"        , gACCOUNT_ID          );
				IDbDataParameter parPAYMENT_DATE       = Sql.AddParameter(cmd, "@PAYMENT_DATE"      , dtPAYMENT_DATE       );
				IDbDataParameter parPAYMENT_TYPE       = Sql.AddParameter(cmd, "@PAYMENT_TYPE"      , sPAYMENT_TYPE        ,  25);
				IDbDataParameter parCUSTOMER_REFERENCE = Sql.AddParameter(cmd, "@CUSTOMER_REFERENCE", sCUSTOMER_REFERENCE  ,  50);
				IDbDataParameter parEXCHANGE_RATE      = Sql.AddParameter(cmd, "@EXCHANGE_RATE"     , flEXCHANGE_RATE      );
				IDbDataParameter parCURRENCY_ID        = Sql.AddParameter(cmd, "@CURRENCY_ID"       , gCURRENCY_ID         );
				IDbDataParameter parAMOUNT             = Sql.AddParameter(cmd, "@AMOUNT"            , dAMOUNT              );
				IDbDataParameter parDESCRIPTION        = Sql.AddParameter(cmd, "@DESCRIPTION"       , sDESCRIPTION         );
				IDbDataParameter parTEAM_ID            = Sql.AddParameter(cmd, "@TEAM_ID"           , gTEAM_ID             );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPAYMENTS_Update
		/// <summary>
		/// spPAYMENTS_Update
		/// </summary>
		public static IDbCommand cmdPAYMENTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPAYMENTS_Update";
			IDbDataParameter parID                 = Sql.CreateParameter(cmd, "@ID"                , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID   = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"  , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID   = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"  , "Guid",  16);
			IDbDataParameter parACCOUNT_ID         = Sql.CreateParameter(cmd, "@ACCOUNT_ID"        , "Guid",  16);
			IDbDataParameter parPAYMENT_DATE       = Sql.CreateParameter(cmd, "@PAYMENT_DATE"      , "DateTime",   8);
			IDbDataParameter parPAYMENT_TYPE       = Sql.CreateParameter(cmd, "@PAYMENT_TYPE"      , "string",  25);
			IDbDataParameter parCUSTOMER_REFERENCE = Sql.CreateParameter(cmd, "@CUSTOMER_REFERENCE", "string",  50);
			IDbDataParameter parEXCHANGE_RATE      = Sql.CreateParameter(cmd, "@EXCHANGE_RATE"     , "float",   8);
			IDbDataParameter parCURRENCY_ID        = Sql.CreateParameter(cmd, "@CURRENCY_ID"       , "Guid",  16);
			IDbDataParameter parAMOUNT             = Sql.CreateParameter(cmd, "@AMOUNT"            , "decimal",   8);
			IDbDataParameter parDESCRIPTION        = Sql.CreateParameter(cmd, "@DESCRIPTION"       , "string", 104857600);
			IDbDataParameter parTEAM_ID            = Sql.CreateParameter(cmd, "@TEAM_ID"           , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPOSTS_Delete
		/// <summary>
		/// spPOSTS_Delete
		/// </summary>
		public static void spPOSTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPOSTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPOSTS_Delete
		/// <summary>
		/// spPOSTS_Delete
		/// </summary>
		public static void spPOSTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPOSTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPOSTS_Delete
		/// <summary>
		/// spPOSTS_Delete
		/// </summary>
		public static IDbCommand cmdPOSTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPOSTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPOSTS_Update
		/// <summary>
		/// spPOSTS_Update
		/// </summary>
		public static void spPOSTS_Update(ref Guid gID, Guid gTHREAD_ID, string sTITLE, string sDESCRIPTION_HTML)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPOSTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 255);
							IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPOSTS_Update
		/// <summary>
		/// spPOSTS_Update
		/// </summary>
		public static void spPOSTS_Update(ref Guid gID, Guid gTHREAD_ID, string sTITLE, string sDESCRIPTION_HTML, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPOSTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 255);
				IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPOSTS_Update
		/// <summary>
		/// spPOSTS_Update
		/// </summary>
		public static IDbCommand cmdPOSTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPOSTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			IDbDataParameter parTITLE            = Sql.CreateParameter(cmd, "@TITLE"           , "string", 255);
			IDbDataParameter parDESCRIPTION_HTML = Sql.CreateParameter(cmd, "@DESCRIPTION_HTML", "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPRODUCT_CATEGORIES_Delete
		/// <summary>
		/// spPRODUCT_CATEGORIES_Delete
		/// </summary>
		public static void spPRODUCT_CATEGORIES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_CATEGORIES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_CATEGORIES_Delete
		/// <summary>
		/// spPRODUCT_CATEGORIES_Delete
		/// </summary>
		public static void spPRODUCT_CATEGORIES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_CATEGORIES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCT_CATEGORIES_Delete
		/// <summary>
		/// spPRODUCT_CATEGORIES_Delete
		/// </summary>
		public static IDbCommand cmdPRODUCT_CATEGORIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_CATEGORIES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCT_CATEGORIES_Update
		/// <summary>
		/// spPRODUCT_CATEGORIES_Update
		/// </summary>
		public static void spPRODUCT_CATEGORIES_Update(ref Guid gID, Guid gPARENT_ID, string sNAME, string sDESCRIPTION, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_CATEGORIES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_CATEGORIES_Update
		/// <summary>
		/// spPRODUCT_CATEGORIES_Update
		/// </summary>
		public static void spPRODUCT_CATEGORIES_Update(ref Guid gID, Guid gPARENT_ID, string sNAME, string sDESCRIPTION, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_CATEGORIES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPRODUCT_CATEGORIES_Update
		/// <summary>
		/// spPRODUCT_CATEGORIES_Update
		/// </summary>
		public static IDbCommand cmdPRODUCT_CATEGORIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_CATEGORIES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPRODUCT_PRODUCT_Delete
		/// <summary>
		/// spPRODUCT_PRODUCT_Delete
		/// </summary>
		public static void spPRODUCT_PRODUCT_Delete(Guid gPARENT_ID, Guid gCHILD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_PRODUCT_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parCHILD_ID         = Sql.AddParameter(cmd, "@CHILD_ID"        , gCHILD_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_PRODUCT_Delete
		/// <summary>
		/// spPRODUCT_PRODUCT_Delete
		/// </summary>
		public static void spPRODUCT_PRODUCT_Delete(Guid gPARENT_ID, Guid gCHILD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_PRODUCT_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parCHILD_ID         = Sql.AddParameter(cmd, "@CHILD_ID"        , gCHILD_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCT_PRODUCT_Delete
		/// <summary>
		/// spPRODUCT_PRODUCT_Delete
		/// </summary>
		public static IDbCommand cmdPRODUCT_PRODUCT_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_PRODUCT_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parCHILD_ID         = Sql.CreateParameter(cmd, "@CHILD_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCT_PRODUCT_Update
		/// <summary>
		/// spPRODUCT_PRODUCT_Update
		/// </summary>
		public static void spPRODUCT_PRODUCT_Update(Guid gPARENT_ID, Guid gCHILD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_PRODUCT_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parCHILD_ID         = Sql.AddParameter(cmd, "@CHILD_ID"        , gCHILD_ID          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_PRODUCT_Update
		/// <summary>
		/// spPRODUCT_PRODUCT_Update
		/// </summary>
		public static void spPRODUCT_PRODUCT_Update(Guid gPARENT_ID, Guid gCHILD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_PRODUCT_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parCHILD_ID         = Sql.AddParameter(cmd, "@CHILD_ID"        , gCHILD_ID          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCT_PRODUCT_Update
		/// <summary>
		/// spPRODUCT_PRODUCT_Update
		/// </summary>
		public static IDbCommand cmdPRODUCT_PRODUCT_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_PRODUCT_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parCHILD_ID         = Sql.CreateParameter(cmd, "@CHILD_ID"        , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCT_TEMPLATES_Delete
		/// <summary>
		/// spPRODUCT_TEMPLATES_Delete
		/// </summary>
		public static void spPRODUCT_TEMPLATES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_TEMPLATES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_TEMPLATES_Delete
		/// <summary>
		/// spPRODUCT_TEMPLATES_Delete
		/// </summary>
		public static void spPRODUCT_TEMPLATES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_TEMPLATES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCT_TEMPLATES_Delete
		/// <summary>
		/// spPRODUCT_TEMPLATES_Delete
		/// </summary>
		public static IDbCommand cmdPRODUCT_TEMPLATES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_TEMPLATES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCT_TEMPLATES_Update
		/// <summary>
		/// spPRODUCT_TEMPLATES_Update
		/// </summary>
		public static void spPRODUCT_TEMPLATES_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nQUANTITY, DateTime dtDATE_AVAILABLE, DateTime dtDATE_COST_PRICE, Guid gACCOUNT_ID, Guid gMANUFACTURER_ID, Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM, string sVENDOR_PART_NUM, string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA, string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION, string sSUPPORT_TERM, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_TEMPLATES_Update";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 ,  50);
							IDbDataParameter parSTATUS              = Sql.AddParameter(cmd, "@STATUS"             , sSTATUS               ,  25);
							IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
							IDbDataParameter parDATE_AVAILABLE      = Sql.AddParameter(cmd, "@DATE_AVAILABLE"     , dtDATE_AVAILABLE      );
							IDbDataParameter parDATE_COST_PRICE     = Sql.AddParameter(cmd, "@DATE_COST_PRICE"    , dtDATE_COST_PRICE     );
							IDbDataParameter parACCOUNT_ID          = Sql.AddParameter(cmd, "@ACCOUNT_ID"         , gACCOUNT_ID           );
							IDbDataParameter parMANUFACTURER_ID     = Sql.AddParameter(cmd, "@MANUFACTURER_ID"    , gMANUFACTURER_ID      );
							IDbDataParameter parCATEGORY_ID         = Sql.AddParameter(cmd, "@CATEGORY_ID"        , gCATEGORY_ID          );
							IDbDataParameter parTYPE_ID             = Sql.AddParameter(cmd, "@TYPE_ID"            , gTYPE_ID              );
							IDbDataParameter parWEBSITE             = Sql.AddParameter(cmd, "@WEBSITE"            , sWEBSITE              , 255);
							IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
							IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
							IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
							IDbDataParameter parWEIGHT              = Sql.AddParameter(cmd, "@WEIGHT"             , flWEIGHT              );
							IDbDataParameter parCURRENCY_ID         = Sql.AddParameter(cmd, "@CURRENCY_ID"        , gCURRENCY_ID          );
							IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
							IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
							IDbDataParameter parDISCOUNT_PRICE      = Sql.AddParameter(cmd, "@DISCOUNT_PRICE"     , dDISCOUNT_PRICE       );
							IDbDataParameter parPRICING_FACTOR      = Sql.AddParameter(cmd, "@PRICING_FACTOR"     , nPRICING_FACTOR       );
							IDbDataParameter parPRICING_FORMULA     = Sql.AddParameter(cmd, "@PRICING_FORMULA"    , sPRICING_FORMULA      ,  25);
							IDbDataParameter parSUPPORT_NAME        = Sql.AddParameter(cmd, "@SUPPORT_NAME"       , sSUPPORT_NAME         ,  50);
							IDbDataParameter parSUPPORT_CONTACT     = Sql.AddParameter(cmd, "@SUPPORT_CONTACT"    , sSUPPORT_CONTACT      ,  50);
							IDbDataParameter parSUPPORT_DESCRIPTION = Sql.AddParameter(cmd, "@SUPPORT_DESCRIPTION", sSUPPORT_DESCRIPTION  , 255);
							IDbDataParameter parSUPPORT_TERM        = Sql.AddParameter(cmd, "@SUPPORT_TERM"       , sSUPPORT_TERM         ,  25);
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_TEMPLATES_Update
		/// <summary>
		/// spPRODUCT_TEMPLATES_Update
		/// </summary>
		public static void spPRODUCT_TEMPLATES_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nQUANTITY, DateTime dtDATE_AVAILABLE, DateTime dtDATE_COST_PRICE, Guid gACCOUNT_ID, Guid gMANUFACTURER_ID, Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM, string sVENDOR_PART_NUM, string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA, string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION, string sSUPPORT_TERM, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_TEMPLATES_Update";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 ,  50);
				IDbDataParameter parSTATUS              = Sql.AddParameter(cmd, "@STATUS"             , sSTATUS               ,  25);
				IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
				IDbDataParameter parDATE_AVAILABLE      = Sql.AddParameter(cmd, "@DATE_AVAILABLE"     , dtDATE_AVAILABLE      );
				IDbDataParameter parDATE_COST_PRICE     = Sql.AddParameter(cmd, "@DATE_COST_PRICE"    , dtDATE_COST_PRICE     );
				IDbDataParameter parACCOUNT_ID          = Sql.AddParameter(cmd, "@ACCOUNT_ID"         , gACCOUNT_ID           );
				IDbDataParameter parMANUFACTURER_ID     = Sql.AddParameter(cmd, "@MANUFACTURER_ID"    , gMANUFACTURER_ID      );
				IDbDataParameter parCATEGORY_ID         = Sql.AddParameter(cmd, "@CATEGORY_ID"        , gCATEGORY_ID          );
				IDbDataParameter parTYPE_ID             = Sql.AddParameter(cmd, "@TYPE_ID"            , gTYPE_ID              );
				IDbDataParameter parWEBSITE             = Sql.AddParameter(cmd, "@WEBSITE"            , sWEBSITE              , 255);
				IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
				IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
				IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
				IDbDataParameter parWEIGHT              = Sql.AddParameter(cmd, "@WEIGHT"             , flWEIGHT              );
				IDbDataParameter parCURRENCY_ID         = Sql.AddParameter(cmd, "@CURRENCY_ID"        , gCURRENCY_ID          );
				IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
				IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
				IDbDataParameter parDISCOUNT_PRICE      = Sql.AddParameter(cmd, "@DISCOUNT_PRICE"     , dDISCOUNT_PRICE       );
				IDbDataParameter parPRICING_FACTOR      = Sql.AddParameter(cmd, "@PRICING_FACTOR"     , nPRICING_FACTOR       );
				IDbDataParameter parPRICING_FORMULA     = Sql.AddParameter(cmd, "@PRICING_FORMULA"    , sPRICING_FORMULA      ,  25);
				IDbDataParameter parSUPPORT_NAME        = Sql.AddParameter(cmd, "@SUPPORT_NAME"       , sSUPPORT_NAME         ,  50);
				IDbDataParameter parSUPPORT_CONTACT     = Sql.AddParameter(cmd, "@SUPPORT_CONTACT"    , sSUPPORT_CONTACT      ,  50);
				IDbDataParameter parSUPPORT_DESCRIPTION = Sql.AddParameter(cmd, "@SUPPORT_DESCRIPTION", sSUPPORT_DESCRIPTION  , 255);
				IDbDataParameter parSUPPORT_TERM        = Sql.AddParameter(cmd, "@SUPPORT_TERM"       , sSUPPORT_TERM         ,  25);
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPRODUCT_TEMPLATES_Update
		/// <summary>
		/// spPRODUCT_TEMPLATES_Update
		/// </summary>
		public static IDbCommand cmdPRODUCT_TEMPLATES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_TEMPLATES_Update";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parNAME                = Sql.CreateParameter(cmd, "@NAME"               , "string",  50);
			IDbDataParameter parSTATUS              = Sql.CreateParameter(cmd, "@STATUS"             , "string",  25);
			IDbDataParameter parQUANTITY            = Sql.CreateParameter(cmd, "@QUANTITY"           , "Int32",   4);
			IDbDataParameter parDATE_AVAILABLE      = Sql.CreateParameter(cmd, "@DATE_AVAILABLE"     , "DateTime",   8);
			IDbDataParameter parDATE_COST_PRICE     = Sql.CreateParameter(cmd, "@DATE_COST_PRICE"    , "DateTime",   8);
			IDbDataParameter parACCOUNT_ID          = Sql.CreateParameter(cmd, "@ACCOUNT_ID"         , "Guid",  16);
			IDbDataParameter parMANUFACTURER_ID     = Sql.CreateParameter(cmd, "@MANUFACTURER_ID"    , "Guid",  16);
			IDbDataParameter parCATEGORY_ID         = Sql.CreateParameter(cmd, "@CATEGORY_ID"        , "Guid",  16);
			IDbDataParameter parTYPE_ID             = Sql.CreateParameter(cmd, "@TYPE_ID"            , "Guid",  16);
			IDbDataParameter parWEBSITE             = Sql.CreateParameter(cmd, "@WEBSITE"            , "string", 255);
			IDbDataParameter parMFT_PART_NUM        = Sql.CreateParameter(cmd, "@MFT_PART_NUM"       , "string",  50);
			IDbDataParameter parVENDOR_PART_NUM     = Sql.CreateParameter(cmd, "@VENDOR_PART_NUM"    , "string",  50);
			IDbDataParameter parTAX_CLASS           = Sql.CreateParameter(cmd, "@TAX_CLASS"          , "string",  25);
			IDbDataParameter parWEIGHT              = Sql.CreateParameter(cmd, "@WEIGHT"             , "float",   8);
			IDbDataParameter parCURRENCY_ID         = Sql.CreateParameter(cmd, "@CURRENCY_ID"        , "Guid",  16);
			IDbDataParameter parCOST_PRICE          = Sql.CreateParameter(cmd, "@COST_PRICE"         , "decimal",   8);
			IDbDataParameter parLIST_PRICE          = Sql.CreateParameter(cmd, "@LIST_PRICE"         , "decimal",   8);
			IDbDataParameter parDISCOUNT_PRICE      = Sql.CreateParameter(cmd, "@DISCOUNT_PRICE"     , "decimal",   8);
			IDbDataParameter parPRICING_FACTOR      = Sql.CreateParameter(cmd, "@PRICING_FACTOR"     , "Int32",   4);
			IDbDataParameter parPRICING_FORMULA     = Sql.CreateParameter(cmd, "@PRICING_FORMULA"    , "string",  25);
			IDbDataParameter parSUPPORT_NAME        = Sql.CreateParameter(cmd, "@SUPPORT_NAME"       , "string",  50);
			IDbDataParameter parSUPPORT_CONTACT     = Sql.CreateParameter(cmd, "@SUPPORT_CONTACT"    , "string",  50);
			IDbDataParameter parSUPPORT_DESCRIPTION = Sql.CreateParameter(cmd, "@SUPPORT_DESCRIPTION", "string", 255);
			IDbDataParameter parSUPPORT_TERM        = Sql.CreateParameter(cmd, "@SUPPORT_TERM"       , "string",  25);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPRODUCT_TYPES_Delete
		/// <summary>
		/// spPRODUCT_TYPES_Delete
		/// </summary>
		public static void spPRODUCT_TYPES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_TYPES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_TYPES_Delete
		/// <summary>
		/// spPRODUCT_TYPES_Delete
		/// </summary>
		public static void spPRODUCT_TYPES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_TYPES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCT_TYPES_Delete
		/// <summary>
		/// spPRODUCT_TYPES_Delete
		/// </summary>
		public static IDbCommand cmdPRODUCT_TYPES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_TYPES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCT_TYPES_Update
		/// <summary>
		/// spPRODUCT_TYPES_Update
		/// </summary>
		public static void spPRODUCT_TYPES_Update(ref Guid gID, string sNAME, string sDESCRIPTION, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCT_TYPES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCT_TYPES_Update
		/// <summary>
		/// spPRODUCT_TYPES_Update
		/// </summary>
		public static void spPRODUCT_TYPES_Update(ref Guid gID, string sNAME, string sDESCRIPTION, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCT_TYPES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPRODUCT_TYPES_Update
		/// <summary>
		/// spPRODUCT_TYPES_Update
		/// </summary>
		public static IDbCommand cmdPRODUCT_TYPES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCT_TYPES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPRODUCTS_Delete
		/// <summary>
		/// spPRODUCTS_Delete
		/// </summary>
		public static void spPRODUCTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCTS_Delete
		/// <summary>
		/// spPRODUCTS_Delete
		/// </summary>
		public static void spPRODUCTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCTS_Delete
		/// <summary>
		/// spPRODUCTS_Delete
		/// </summary>
		public static IDbCommand cmdPRODUCTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCTS_MassDelete
		/// <summary>
		/// spPRODUCTS_MassDelete
		/// </summary>
		public static void spPRODUCTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCTS_MassDelete
		/// <summary>
		/// spPRODUCTS_MassDelete
		/// </summary>
		public static void spPRODUCTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPRODUCTS_MassDelete
		/// <summary>
		/// spPRODUCTS_MassDelete
		/// </summary>
		public static IDbCommand cmdPRODUCTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPRODUCTS_Update
		/// <summary>
		/// spPRODUCTS_Update
		/// </summary>
		public static void spPRODUCTS_Update(ref Guid gID, Guid gPRODUCT_TEMPLATE_ID, string sNAME, string sSTATUS, Guid gACCOUNT_ID, Guid gCONTACT_ID, Int32 nQUANTITY, DateTime dtDATE_PURCHASED, DateTime dtDATE_SUPPORT_EXPIRES, DateTime dtDATE_SUPPORT_STARTS, Guid gMANUFACTURER_ID, Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM, string sVENDOR_PART_NUM, string sSERIAL_NUMBER, string sASSET_NUMBER, string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dBOOK_VALUE, DateTime dtBOOK_VALUE_DATE, decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA, string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION, string sSUPPORT_TERM, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPRODUCTS_Update";
							IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
							IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
							IDbDataParameter parPRODUCT_TEMPLATE_ID  = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID" , gPRODUCT_TEMPLATE_ID   );
							IDbDataParameter parNAME                 = Sql.AddParameter(cmd, "@NAME"                , sNAME                  ,  50);
							IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
							IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
							IDbDataParameter parCONTACT_ID           = Sql.AddParameter(cmd, "@CONTACT_ID"          , gCONTACT_ID            );
							IDbDataParameter parQUANTITY             = Sql.AddParameter(cmd, "@QUANTITY"            , nQUANTITY              );
							IDbDataParameter parDATE_PURCHASED       = Sql.AddParameter(cmd, "@DATE_PURCHASED"      , dtDATE_PURCHASED       );
							IDbDataParameter parDATE_SUPPORT_EXPIRES = Sql.AddParameter(cmd, "@DATE_SUPPORT_EXPIRES", dtDATE_SUPPORT_EXPIRES );
							IDbDataParameter parDATE_SUPPORT_STARTS  = Sql.AddParameter(cmd, "@DATE_SUPPORT_STARTS" , dtDATE_SUPPORT_STARTS  );
							IDbDataParameter parMANUFACTURER_ID      = Sql.AddParameter(cmd, "@MANUFACTURER_ID"     , gMANUFACTURER_ID       );
							IDbDataParameter parCATEGORY_ID          = Sql.AddParameter(cmd, "@CATEGORY_ID"         , gCATEGORY_ID           );
							IDbDataParameter parTYPE_ID              = Sql.AddParameter(cmd, "@TYPE_ID"             , gTYPE_ID               );
							IDbDataParameter parWEBSITE              = Sql.AddParameter(cmd, "@WEBSITE"             , sWEBSITE               , 255);
							IDbDataParameter parMFT_PART_NUM         = Sql.AddParameter(cmd, "@MFT_PART_NUM"        , sMFT_PART_NUM          ,  50);
							IDbDataParameter parVENDOR_PART_NUM      = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"     , sVENDOR_PART_NUM       ,  50);
							IDbDataParameter parSERIAL_NUMBER        = Sql.AddParameter(cmd, "@SERIAL_NUMBER"       , sSERIAL_NUMBER         ,  50);
							IDbDataParameter parASSET_NUMBER         = Sql.AddParameter(cmd, "@ASSET_NUMBER"        , sASSET_NUMBER          ,  50);
							IDbDataParameter parTAX_CLASS            = Sql.AddParameter(cmd, "@TAX_CLASS"           , sTAX_CLASS             ,  25);
							IDbDataParameter parWEIGHT               = Sql.AddParameter(cmd, "@WEIGHT"              , flWEIGHT               );
							IDbDataParameter parCURRENCY_ID          = Sql.AddParameter(cmd, "@CURRENCY_ID"         , gCURRENCY_ID           );
							IDbDataParameter parCOST_PRICE           = Sql.AddParameter(cmd, "@COST_PRICE"          , dCOST_PRICE            );
							IDbDataParameter parLIST_PRICE           = Sql.AddParameter(cmd, "@LIST_PRICE"          , dLIST_PRICE            );
							IDbDataParameter parBOOK_VALUE           = Sql.AddParameter(cmd, "@BOOK_VALUE"          , dBOOK_VALUE            );
							IDbDataParameter parBOOK_VALUE_DATE      = Sql.AddParameter(cmd, "@BOOK_VALUE_DATE"     , dtBOOK_VALUE_DATE      );
							IDbDataParameter parDISCOUNT_PRICE       = Sql.AddParameter(cmd, "@DISCOUNT_PRICE"      , dDISCOUNT_PRICE        );
							IDbDataParameter parPRICING_FACTOR       = Sql.AddParameter(cmd, "@PRICING_FACTOR"      , nPRICING_FACTOR        );
							IDbDataParameter parPRICING_FORMULA      = Sql.AddParameter(cmd, "@PRICING_FORMULA"     , sPRICING_FORMULA       ,  25);
							IDbDataParameter parSUPPORT_NAME         = Sql.AddParameter(cmd, "@SUPPORT_NAME"        , sSUPPORT_NAME          ,  50);
							IDbDataParameter parSUPPORT_CONTACT      = Sql.AddParameter(cmd, "@SUPPORT_CONTACT"     , sSUPPORT_CONTACT       ,  50);
							IDbDataParameter parSUPPORT_DESCRIPTION  = Sql.AddParameter(cmd, "@SUPPORT_DESCRIPTION" , sSUPPORT_DESCRIPTION   , 255);
							IDbDataParameter parSUPPORT_TERM         = Sql.AddParameter(cmd, "@SUPPORT_TERM"        , sSUPPORT_TERM          ,  25);
							IDbDataParameter parDESCRIPTION          = Sql.AddParameter(cmd, "@DESCRIPTION"         , sDESCRIPTION           );
							IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPRODUCTS_Update
		/// <summary>
		/// spPRODUCTS_Update
		/// </summary>
		public static void spPRODUCTS_Update(ref Guid gID, Guid gPRODUCT_TEMPLATE_ID, string sNAME, string sSTATUS, Guid gACCOUNT_ID, Guid gCONTACT_ID, Int32 nQUANTITY, DateTime dtDATE_PURCHASED, DateTime dtDATE_SUPPORT_EXPIRES, DateTime dtDATE_SUPPORT_STARTS, Guid gMANUFACTURER_ID, Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM, string sVENDOR_PART_NUM, string sSERIAL_NUMBER, string sASSET_NUMBER, string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dBOOK_VALUE, DateTime dtBOOK_VALUE_DATE, decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA, string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION, string sSUPPORT_TERM, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPRODUCTS_Update";
				IDbDataParameter parID                   = Sql.AddParameter(cmd, "@ID"                  , gID                    );
				IDbDataParameter parMODIFIED_USER_ID     = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"    ,  Security.USER_ID      );
				IDbDataParameter parPRODUCT_TEMPLATE_ID  = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID" , gPRODUCT_TEMPLATE_ID   );
				IDbDataParameter parNAME                 = Sql.AddParameter(cmd, "@NAME"                , sNAME                  ,  50);
				IDbDataParameter parSTATUS               = Sql.AddParameter(cmd, "@STATUS"              , sSTATUS                ,  25);
				IDbDataParameter parACCOUNT_ID           = Sql.AddParameter(cmd, "@ACCOUNT_ID"          , gACCOUNT_ID            );
				IDbDataParameter parCONTACT_ID           = Sql.AddParameter(cmd, "@CONTACT_ID"          , gCONTACT_ID            );
				IDbDataParameter parQUANTITY             = Sql.AddParameter(cmd, "@QUANTITY"            , nQUANTITY              );
				IDbDataParameter parDATE_PURCHASED       = Sql.AddParameter(cmd, "@DATE_PURCHASED"      , dtDATE_PURCHASED       );
				IDbDataParameter parDATE_SUPPORT_EXPIRES = Sql.AddParameter(cmd, "@DATE_SUPPORT_EXPIRES", dtDATE_SUPPORT_EXPIRES );
				IDbDataParameter parDATE_SUPPORT_STARTS  = Sql.AddParameter(cmd, "@DATE_SUPPORT_STARTS" , dtDATE_SUPPORT_STARTS  );
				IDbDataParameter parMANUFACTURER_ID      = Sql.AddParameter(cmd, "@MANUFACTURER_ID"     , gMANUFACTURER_ID       );
				IDbDataParameter parCATEGORY_ID          = Sql.AddParameter(cmd, "@CATEGORY_ID"         , gCATEGORY_ID           );
				IDbDataParameter parTYPE_ID              = Sql.AddParameter(cmd, "@TYPE_ID"             , gTYPE_ID               );
				IDbDataParameter parWEBSITE              = Sql.AddParameter(cmd, "@WEBSITE"             , sWEBSITE               , 255);
				IDbDataParameter parMFT_PART_NUM         = Sql.AddParameter(cmd, "@MFT_PART_NUM"        , sMFT_PART_NUM          ,  50);
				IDbDataParameter parVENDOR_PART_NUM      = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"     , sVENDOR_PART_NUM       ,  50);
				IDbDataParameter parSERIAL_NUMBER        = Sql.AddParameter(cmd, "@SERIAL_NUMBER"       , sSERIAL_NUMBER         ,  50);
				IDbDataParameter parASSET_NUMBER         = Sql.AddParameter(cmd, "@ASSET_NUMBER"        , sASSET_NUMBER          ,  50);
				IDbDataParameter parTAX_CLASS            = Sql.AddParameter(cmd, "@TAX_CLASS"           , sTAX_CLASS             ,  25);
				IDbDataParameter parWEIGHT               = Sql.AddParameter(cmd, "@WEIGHT"              , flWEIGHT               );
				IDbDataParameter parCURRENCY_ID          = Sql.AddParameter(cmd, "@CURRENCY_ID"         , gCURRENCY_ID           );
				IDbDataParameter parCOST_PRICE           = Sql.AddParameter(cmd, "@COST_PRICE"          , dCOST_PRICE            );
				IDbDataParameter parLIST_PRICE           = Sql.AddParameter(cmd, "@LIST_PRICE"          , dLIST_PRICE            );
				IDbDataParameter parBOOK_VALUE           = Sql.AddParameter(cmd, "@BOOK_VALUE"          , dBOOK_VALUE            );
				IDbDataParameter parBOOK_VALUE_DATE      = Sql.AddParameter(cmd, "@BOOK_VALUE_DATE"     , dtBOOK_VALUE_DATE      );
				IDbDataParameter parDISCOUNT_PRICE       = Sql.AddParameter(cmd, "@DISCOUNT_PRICE"      , dDISCOUNT_PRICE        );
				IDbDataParameter parPRICING_FACTOR       = Sql.AddParameter(cmd, "@PRICING_FACTOR"      , nPRICING_FACTOR        );
				IDbDataParameter parPRICING_FORMULA      = Sql.AddParameter(cmd, "@PRICING_FORMULA"     , sPRICING_FORMULA       ,  25);
				IDbDataParameter parSUPPORT_NAME         = Sql.AddParameter(cmd, "@SUPPORT_NAME"        , sSUPPORT_NAME          ,  50);
				IDbDataParameter parSUPPORT_CONTACT      = Sql.AddParameter(cmd, "@SUPPORT_CONTACT"     , sSUPPORT_CONTACT       ,  50);
				IDbDataParameter parSUPPORT_DESCRIPTION  = Sql.AddParameter(cmd, "@SUPPORT_DESCRIPTION" , sSUPPORT_DESCRIPTION   , 255);
				IDbDataParameter parSUPPORT_TERM         = Sql.AddParameter(cmd, "@SUPPORT_TERM"        , sSUPPORT_TERM          ,  25);
				IDbDataParameter parDESCRIPTION          = Sql.AddParameter(cmd, "@DESCRIPTION"         , sDESCRIPTION           );
				IDbDataParameter parTEAM_ID              = Sql.AddParameter(cmd, "@TEAM_ID"             , gTEAM_ID               );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPRODUCTS_Update
		/// <summary>
		/// spPRODUCTS_Update
		/// </summary>
		public static IDbCommand cmdPRODUCTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPRODUCTS_Update";
			IDbDataParameter parID                   = Sql.CreateParameter(cmd, "@ID"                  , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID     = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"    , "Guid",  16);
			IDbDataParameter parPRODUCT_TEMPLATE_ID  = Sql.CreateParameter(cmd, "@PRODUCT_TEMPLATE_ID" , "Guid",  16);
			IDbDataParameter parNAME                 = Sql.CreateParameter(cmd, "@NAME"                , "string",  50);
			IDbDataParameter parSTATUS               = Sql.CreateParameter(cmd, "@STATUS"              , "string",  25);
			IDbDataParameter parACCOUNT_ID           = Sql.CreateParameter(cmd, "@ACCOUNT_ID"          , "Guid",  16);
			IDbDataParameter parCONTACT_ID           = Sql.CreateParameter(cmd, "@CONTACT_ID"          , "Guid",  16);
			IDbDataParameter parQUANTITY             = Sql.CreateParameter(cmd, "@QUANTITY"            , "Int32",   4);
			IDbDataParameter parDATE_PURCHASED       = Sql.CreateParameter(cmd, "@DATE_PURCHASED"      , "DateTime",   8);
			IDbDataParameter parDATE_SUPPORT_EXPIRES = Sql.CreateParameter(cmd, "@DATE_SUPPORT_EXPIRES", "DateTime",   8);
			IDbDataParameter parDATE_SUPPORT_STARTS  = Sql.CreateParameter(cmd, "@DATE_SUPPORT_STARTS" , "DateTime",   8);
			IDbDataParameter parMANUFACTURER_ID      = Sql.CreateParameter(cmd, "@MANUFACTURER_ID"     , "Guid",  16);
			IDbDataParameter parCATEGORY_ID          = Sql.CreateParameter(cmd, "@CATEGORY_ID"         , "Guid",  16);
			IDbDataParameter parTYPE_ID              = Sql.CreateParameter(cmd, "@TYPE_ID"             , "Guid",  16);
			IDbDataParameter parWEBSITE              = Sql.CreateParameter(cmd, "@WEBSITE"             , "string", 255);
			IDbDataParameter parMFT_PART_NUM         = Sql.CreateParameter(cmd, "@MFT_PART_NUM"        , "string",  50);
			IDbDataParameter parVENDOR_PART_NUM      = Sql.CreateParameter(cmd, "@VENDOR_PART_NUM"     , "string",  50);
			IDbDataParameter parSERIAL_NUMBER        = Sql.CreateParameter(cmd, "@SERIAL_NUMBER"       , "string",  50);
			IDbDataParameter parASSET_NUMBER         = Sql.CreateParameter(cmd, "@ASSET_NUMBER"        , "string",  50);
			IDbDataParameter parTAX_CLASS            = Sql.CreateParameter(cmd, "@TAX_CLASS"           , "string",  25);
			IDbDataParameter parWEIGHT               = Sql.CreateParameter(cmd, "@WEIGHT"              , "float",   8);
			IDbDataParameter parCURRENCY_ID          = Sql.CreateParameter(cmd, "@CURRENCY_ID"         , "Guid",  16);
			IDbDataParameter parCOST_PRICE           = Sql.CreateParameter(cmd, "@COST_PRICE"          , "decimal",   8);
			IDbDataParameter parLIST_PRICE           = Sql.CreateParameter(cmd, "@LIST_PRICE"          , "decimal",   8);
			IDbDataParameter parBOOK_VALUE           = Sql.CreateParameter(cmd, "@BOOK_VALUE"          , "decimal",   8);
			IDbDataParameter parBOOK_VALUE_DATE      = Sql.CreateParameter(cmd, "@BOOK_VALUE_DATE"     , "DateTime",   8);
			IDbDataParameter parDISCOUNT_PRICE       = Sql.CreateParameter(cmd, "@DISCOUNT_PRICE"      , "decimal",   8);
			IDbDataParameter parPRICING_FACTOR       = Sql.CreateParameter(cmd, "@PRICING_FACTOR"      , "Int32",   4);
			IDbDataParameter parPRICING_FORMULA      = Sql.CreateParameter(cmd, "@PRICING_FORMULA"     , "string",  25);
			IDbDataParameter parSUPPORT_NAME         = Sql.CreateParameter(cmd, "@SUPPORT_NAME"        , "string",  50);
			IDbDataParameter parSUPPORT_CONTACT      = Sql.CreateParameter(cmd, "@SUPPORT_CONTACT"     , "string",  50);
			IDbDataParameter parSUPPORT_DESCRIPTION  = Sql.CreateParameter(cmd, "@SUPPORT_DESCRIPTION" , "string", 255);
			IDbDataParameter parSUPPORT_TERM         = Sql.CreateParameter(cmd, "@SUPPORT_TERM"        , "string",  25);
			IDbDataParameter parDESCRIPTION          = Sql.CreateParameter(cmd, "@DESCRIPTION"         , "string", 104857600);
			IDbDataParameter parTEAM_ID              = Sql.CreateParameter(cmd, "@TEAM_ID"             , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROJECT_RELATION_Delete
		/// <summary>
		/// spPROJECT_RELATION_Delete
		/// </summary>
		public static void spPROJECT_RELATION_Delete(Guid gPROJECT_ID, Guid gRELATION_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_RELATION_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							IDbDataParameter parRELATION_ID      = Sql.AddParameter(cmd, "@RELATION_ID"     , gRELATION_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_RELATION_Delete
		/// <summary>
		/// spPROJECT_RELATION_Delete
		/// </summary>
		public static void spPROJECT_RELATION_Delete(Guid gPROJECT_ID, Guid gRELATION_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_RELATION_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				IDbDataParameter parRELATION_ID      = Sql.AddParameter(cmd, "@RELATION_ID"     , gRELATION_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_RELATION_Delete
		/// <summary>
		/// spPROJECT_RELATION_Delete
		/// </summary>
		public static IDbCommand cmdPROJECT_RELATION_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_RELATION_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			IDbDataParameter parRELATION_ID      = Sql.CreateParameter(cmd, "@RELATION_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_RELATION_Update
		/// <summary>
		/// spPROJECT_RELATION_Update
		/// </summary>
		public static void spPROJECT_RELATION_Update(Guid gPROJECT_ID, string sRELATION_TYPE, Guid gRELATION_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_RELATION_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							IDbDataParameter parRELATION_TYPE    = Sql.AddParameter(cmd, "@RELATION_TYPE"   , sRELATION_TYPE     ,  25);
							IDbDataParameter parRELATION_ID      = Sql.AddParameter(cmd, "@RELATION_ID"     , gRELATION_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_RELATION_Update
		/// <summary>
		/// spPROJECT_RELATION_Update
		/// </summary>
		public static void spPROJECT_RELATION_Update(Guid gPROJECT_ID, string sRELATION_TYPE, Guid gRELATION_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_RELATION_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				IDbDataParameter parRELATION_TYPE    = Sql.AddParameter(cmd, "@RELATION_TYPE"   , sRELATION_TYPE     ,  25);
				IDbDataParameter parRELATION_ID      = Sql.AddParameter(cmd, "@RELATION_ID"     , gRELATION_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_RELATION_Update
		/// <summary>
		/// spPROJECT_RELATION_Update
		/// </summary>
		public static IDbCommand cmdPROJECT_RELATION_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_RELATION_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			IDbDataParameter parRELATION_TYPE    = Sql.CreateParameter(cmd, "@RELATION_TYPE"   , "string",  25);
			IDbDataParameter parRELATION_ID      = Sql.CreateParameter(cmd, "@RELATION_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_TASKS_Delete
		/// <summary>
		/// spPROJECT_TASKS_Delete
		/// </summary>
		public static void spPROJECT_TASKS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_TASKS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_TASKS_Delete
		/// <summary>
		/// spPROJECT_TASKS_Delete
		/// </summary>
		public static void spPROJECT_TASKS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_TASKS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_TASKS_Delete
		/// <summary>
		/// spPROJECT_TASKS_Delete
		/// </summary>
		public static IDbCommand cmdPROJECT_TASKS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_TASKS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_TASKS_MassDelete
		/// <summary>
		/// spPROJECT_TASKS_MassDelete
		/// </summary>
		public static void spPROJECT_TASKS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_TASKS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_TASKS_MassDelete
		/// <summary>
		/// spPROJECT_TASKS_MassDelete
		/// </summary>
		public static void spPROJECT_TASKS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_TASKS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_TASKS_MassDelete
		/// <summary>
		/// spPROJECT_TASKS_MassDelete
		/// </summary>
		public static IDbCommand cmdPROJECT_TASKS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_TASKS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_TASKS_MassUpdate
		/// <summary>
		/// spPROJECT_TASKS_MassUpdate
		/// </summary>
		public static void spPROJECT_TASKS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPRIORITY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_TASKS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_TASKS_MassUpdate
		/// <summary>
		/// spPROJECT_TASKS_MassUpdate
		/// </summary>
		public static void spPROJECT_TASKS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPRIORITY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_TASKS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_TASKS_MassUpdate
		/// <summary>
		/// spPROJECT_TASKS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROJECT_TASKS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_TASKS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDATE_TIME_DUE    = Sql.CreateParameter(cmd, "@DATE_TIME_DUE"   , "DateTime",   8);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_TASKS_New
		/// <summary>
		/// spPROJECT_TASKS_New
		/// </summary>
		public static void spPROJECT_TASKS_New(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gPARENT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_TASKS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_TASKS_New
		/// <summary>
		/// spPROJECT_TASKS_New
		/// </summary>
		public static void spPROJECT_TASKS_New(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gPARENT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_TASKS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROJECT_TASKS_New
		/// <summary>
		/// spPROJECT_TASKS_New
		/// </summary>
		public static IDbCommand cmdPROJECT_TASKS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_TASKS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROJECT_TASKS_Update
		/// <summary>
		/// spPROJECT_TASKS_Update
		/// </summary>
		public static void spPROJECT_TASKS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, Guid gPARENT_ID, string sPRIORITY, string sDESCRIPTION, Int32 nORDER_NUMBER, Int32 nTASK_NUMBER, Guid gDEPENDS_ON_ID, bool bMILESTONE_FLAG, Int32 nESTIMATED_EFFORT, Int32 nACTUAL_EFFORT, Int32 nUTILIZATION, Int32 nPERCENT_COMPLETE, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_TASKS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parORDER_NUMBER     = Sql.AddParameter(cmd, "@ORDER_NUMBER"    , nORDER_NUMBER      );
							IDbDataParameter parTASK_NUMBER      = Sql.AddParameter(cmd, "@TASK_NUMBER"     , nTASK_NUMBER       );
							IDbDataParameter parDEPENDS_ON_ID    = Sql.AddParameter(cmd, "@DEPENDS_ON_ID"   , gDEPENDS_ON_ID     );
							IDbDataParameter parMILESTONE_FLAG   = Sql.AddParameter(cmd, "@MILESTONE_FLAG"  , bMILESTONE_FLAG    );
							IDbDataParameter parESTIMATED_EFFORT = Sql.AddParameter(cmd, "@ESTIMATED_EFFORT", nESTIMATED_EFFORT  );
							IDbDataParameter parACTUAL_EFFORT    = Sql.AddParameter(cmd, "@ACTUAL_EFFORT"   , nACTUAL_EFFORT     );
							IDbDataParameter parUTILIZATION      = Sql.AddParameter(cmd, "@UTILIZATION"     , nUTILIZATION       );
							IDbDataParameter parPERCENT_COMPLETE = Sql.AddParameter(cmd, "@PERCENT_COMPLETE", nPERCENT_COMPLETE  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_TASKS_Update
		/// <summary>
		/// spPROJECT_TASKS_Update
		/// </summary>
		public static void spPROJECT_TASKS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, Guid gPARENT_ID, string sPRIORITY, string sDESCRIPTION, Int32 nORDER_NUMBER, Int32 nTASK_NUMBER, Guid gDEPENDS_ON_ID, bool bMILESTONE_FLAG, Int32 nESTIMATED_EFFORT, Int32 nACTUAL_EFFORT, Int32 nUTILIZATION, Int32 nPERCENT_COMPLETE, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_TASKS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parORDER_NUMBER     = Sql.AddParameter(cmd, "@ORDER_NUMBER"    , nORDER_NUMBER      );
				IDbDataParameter parTASK_NUMBER      = Sql.AddParameter(cmd, "@TASK_NUMBER"     , nTASK_NUMBER       );
				IDbDataParameter parDEPENDS_ON_ID    = Sql.AddParameter(cmd, "@DEPENDS_ON_ID"   , gDEPENDS_ON_ID     );
				IDbDataParameter parMILESTONE_FLAG   = Sql.AddParameter(cmd, "@MILESTONE_FLAG"  , bMILESTONE_FLAG    );
				IDbDataParameter parESTIMATED_EFFORT = Sql.AddParameter(cmd, "@ESTIMATED_EFFORT", nESTIMATED_EFFORT  );
				IDbDataParameter parACTUAL_EFFORT    = Sql.AddParameter(cmd, "@ACTUAL_EFFORT"   , nACTUAL_EFFORT     );
				IDbDataParameter parUTILIZATION      = Sql.AddParameter(cmd, "@UTILIZATION"     , nUTILIZATION       );
				IDbDataParameter parPERCENT_COMPLETE = Sql.AddParameter(cmd, "@PERCENT_COMPLETE", nPERCENT_COMPLETE  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROJECT_TASKS_Update
		/// <summary>
		/// spPROJECT_TASKS_Update
		/// </summary>
		public static IDbCommand cmdPROJECT_TASKS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_TASKS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDATE_TIME_DUE    = Sql.CreateParameter(cmd, "@DATE_TIME_DUE"   , "DateTime",   8);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parORDER_NUMBER     = Sql.CreateParameter(cmd, "@ORDER_NUMBER"    , "Int32",   4);
			IDbDataParameter parTASK_NUMBER      = Sql.CreateParameter(cmd, "@TASK_NUMBER"     , "Int32",   4);
			IDbDataParameter parDEPENDS_ON_ID    = Sql.CreateParameter(cmd, "@DEPENDS_ON_ID"   , "Guid",  16);
			IDbDataParameter parMILESTONE_FLAG   = Sql.CreateParameter(cmd, "@MILESTONE_FLAG"  , "bool",   1);
			IDbDataParameter parESTIMATED_EFFORT = Sql.CreateParameter(cmd, "@ESTIMATED_EFFORT", "Int32",   4);
			IDbDataParameter parACTUAL_EFFORT    = Sql.CreateParameter(cmd, "@ACTUAL_EFFORT"   , "Int32",   4);
			IDbDataParameter parUTILIZATION      = Sql.CreateParameter(cmd, "@UTILIZATION"     , "Int32",   4);
			IDbDataParameter parPERCENT_COMPLETE = Sql.CreateParameter(cmd, "@PERCENT_COMPLETE", "Int32",   4);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROJECT_THREADS_Delete
		/// <summary>
		/// spPROJECT_THREADS_Delete
		/// </summary>
		public static void spPROJECT_THREADS_Delete(Guid gPROJECT_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_THREADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_THREADS_Delete
		/// <summary>
		/// spPROJECT_THREADS_Delete
		/// </summary>
		public static void spPROJECT_THREADS_Delete(Guid gPROJECT_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_THREADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_THREADS_Delete
		/// <summary>
		/// spPROJECT_THREADS_Delete
		/// </summary>
		public static IDbCommand cmdPROJECT_THREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_THREADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECT_THREADS_Update
		/// <summary>
		/// spPROJECT_THREADS_Update
		/// </summary>
		public static void spPROJECT_THREADS_Update(Guid gPROJECT_ID, Guid gTHREAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECT_THREADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
							IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECT_THREADS_Update
		/// <summary>
		/// spPROJECT_THREADS_Update
		/// </summary>
		public static void spPROJECT_THREADS_Update(Guid gPROJECT_ID, Guid gTHREAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECT_THREADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROJECT_ID       = Sql.AddParameter(cmd, "@PROJECT_ID"      , gPROJECT_ID        );
				IDbDataParameter parTHREAD_ID        = Sql.AddParameter(cmd, "@THREAD_ID"       , gTHREAD_ID         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECT_THREADS_Update
		/// <summary>
		/// spPROJECT_THREADS_Update
		/// </summary>
		public static IDbCommand cmdPROJECT_THREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECT_THREADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROJECT_ID       = Sql.CreateParameter(cmd, "@PROJECT_ID"      , "Guid",  16);
			IDbDataParameter parTHREAD_ID        = Sql.CreateParameter(cmd, "@THREAD_ID"       , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECTS_Delete
		/// <summary>
		/// spPROJECTS_Delete
		/// </summary>
		public static void spPROJECTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECTS_Delete
		/// <summary>
		/// spPROJECTS_Delete
		/// </summary>
		public static void spPROJECTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECTS_Delete
		/// <summary>
		/// spPROJECTS_Delete
		/// </summary>
		public static IDbCommand cmdPROJECTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECTS_MassDelete
		/// <summary>
		/// spPROJECTS_MassDelete
		/// </summary>
		public static void spPROJECTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECTS_MassDelete
		/// <summary>
		/// spPROJECTS_MassDelete
		/// </summary>
		public static void spPROJECTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECTS_MassDelete
		/// <summary>
		/// spPROJECTS_MassDelete
		/// </summary>
		public static IDbCommand cmdPROJECTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECTS_MassUpdate
		/// <summary>
		/// spPROJECTS_MassUpdate
		/// </summary>
		public static void spPROJECTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECTS_MassUpdate
		/// <summary>
		/// spPROJECTS_MassUpdate
		/// </summary>
		public static void spPROJECTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROJECTS_MassUpdate
		/// <summary>
		/// spPROJECTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROJECTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROJECTS_New
		/// <summary>
		/// spPROJECTS_New
		/// </summary>
		public static void spPROJECTS_New(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECTS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECTS_New
		/// <summary>
		/// spPROJECTS_New
		/// </summary>
		public static void spPROJECTS_New(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECTS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROJECTS_New
		/// <summary>
		/// spPROJECTS_New
		/// </summary>
		public static IDbCommand cmdPROJECTS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECTS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROJECTS_Update
		/// <summary>
		/// spPROJECTS_Update
		/// </summary>
		public static void spPROJECTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROJECTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROJECTS_Update
		/// <summary>
		/// spPROJECTS_Update
		/// </summary>
		public static void spPROJECTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROJECTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROJECTS_Update
		/// <summary>
		/// spPROJECTS_Update
		/// </summary>
		public static IDbCommand cmdPROJECTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROJECTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROSPECT_LIST_CAMPAIGNS_Delete
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Delete
		/// </summary>
		public static void spPROSPECT_LIST_CAMPAIGNS_Delete(Guid gPROSPECT_LIST_ID, Guid gCAMPAIGN_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Dele";
							else
								cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LIST_CAMPAIGNS_Delete
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Delete
		/// </summary>
		public static void spPROSPECT_LIST_CAMPAIGNS_Delete(Guid gPROSPECT_LIST_ID, Guid gCAMPAIGN_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Dele";
				else
					cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LIST_CAMPAIGNS_Delete
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LIST_CAMPAIGNS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Dele";
			else
				cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID      = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LIST_CAMPAIGNS_Update
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Update
		/// </summary>
		public static void spPROSPECT_LIST_CAMPAIGNS_Update(Guid gPROSPECT_LIST_ID, Guid gCAMPAIGN_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Upda";
							else
								cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LIST_CAMPAIGNS_Update
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Update
		/// </summary>
		public static void spPROSPECT_LIST_CAMPAIGNS_Update(Guid gPROSPECT_LIST_ID, Guid gCAMPAIGN_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Upda";
				else
					cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parCAMPAIGN_ID      = Sql.AddParameter(cmd, "@CAMPAIGN_ID"     , gCAMPAIGN_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LIST_CAMPAIGNS_Update
		/// <summary>
		/// spPROSPECT_LIST_CAMPAIGNS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LIST_CAMPAIGNS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Upda";
			else
				cmd.CommandText = "spPROSPECT_LIST_CAMPAIGNS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parCAMPAIGN_ID      = Sql.CreateParameter(cmd, "@CAMPAIGN_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_Delete(Guid gPROSPECT_LIST_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Dele";
							else
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_Delete(Guid gPROSPECT_LIST_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Dele";
				else
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_CONTACTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Dele";
			else
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Mass";
							else
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Mass";
				else
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_CONTACTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_CONTACTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Mass";
			else
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_Update(Guid gPROSPECT_LIST_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Upda";
							else
								cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_CONTACTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_CONTACTS_Update(Guid gPROSPECT_LIST_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Upda";
				else
					cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_CONTACTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Upda";
			else
				cmd.CommandText = "spPROSPECT_LISTS_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_Delete(Guid gPROSPECT_LIST_ID, Guid gLEAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_LEADS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_Delete(Guid gPROSPECT_LIST_ID, Guid gLEAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_LEADS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_LEADS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_LEADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_LEADS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpd";
							else
								cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpd";
				else
					cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_LEADS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_LEADS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpd";
			else
				cmd.CommandText = "spPROSPECT_LISTS_LEADS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_Update
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_Update(Guid gPROSPECT_LIST_ID, Guid gLEAD_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_LEADS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_LEADS_Update
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_LEADS_Update(Guid gPROSPECT_LIST_ID, Guid gLEAD_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_LEADS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parLEAD_ID          = Sql.AddParameter(cmd, "@LEAD_ID"         , gLEAD_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_LEADS_Update
		/// <summary>
		/// spPROSPECT_LISTS_LEADS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_LEADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_LEADS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parLEAD_ID          = Sql.CreateParameter(cmd, "@LEAD_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_MassDelete
		/// <summary>
		/// spPROSPECT_LISTS_MassDelete
		/// </summary>
		public static void spPROSPECT_LISTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_MassDelete
		/// <summary>
		/// spPROSPECT_LISTS_MassDelete
		/// </summary>
		public static void spPROSPECT_LISTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_MassDelete
		/// <summary>
		/// spPROSPECT_LISTS_MassDelete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_New
		/// <summary>
		/// spPROSPECT_LISTS_New
		/// </summary>
		public static void spPROSPECT_LISTS_New(ref Guid gID, string sNAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_New
		/// <summary>
		/// spPROSPECT_LISTS_New
		/// </summary>
		public static void spPROSPECT_LISTS_New(ref Guid gID, string sNAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_New
		/// <summary>
		/// spPROSPECT_LISTS_New
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_Delete(Guid gPROSPECT_LIST_ID, Guid gPROSPECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Del";
							else
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_Delete(Guid gPROSPECT_LIST_ID, Guid gPROSPECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Del";
				else
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_PROSPECTS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_PROSPECTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Del";
			else
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_ID      = Sql.CreateParameter(cmd, "@PROSPECT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Mas";
							else
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Mas";
				else
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_PROSPECTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Mas";
			else
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_Update(Guid gPROSPECT_LIST_ID, Guid gPROSPECT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Upd";
							else
								cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_PROSPECTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_PROSPECTS_Update(Guid gPROSPECT_LIST_ID, Guid gPROSPECT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Upd";
				else
					cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parPROSPECT_ID      = Sql.AddParameter(cmd, "@PROSPECT_ID"     , gPROSPECT_ID       );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_PROSPECTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_PROSPECTS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_PROSPECTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Upd";
			else
				cmd.CommandText = "spPROSPECT_LISTS_PROSPECTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_ID      = Sql.CreateParameter(cmd, "@PROSPECT_ID"     , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, string sLIST_TYPE, string sDOMAIN_NAME, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parLIST_TYPE        = Sql.AddParameter(cmd, "@LIST_TYPE"       , sLIST_TYPE         , 255);
							IDbDataParameter parDOMAIN_NAME      = Sql.AddParameter(cmd, "@DOMAIN_NAME"     , sDOMAIN_NAME       , 255);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, string sLIST_TYPE, string sDOMAIN_NAME, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parLIST_TYPE        = Sql.AddParameter(cmd, "@LIST_TYPE"       , sLIST_TYPE         , 255);
				IDbDataParameter parDOMAIN_NAME      = Sql.AddParameter(cmd, "@DOMAIN_NAME"     , sDOMAIN_NAME       , 255);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_Update
		/// <summary>
		/// spPROSPECT_LISTS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parLIST_TYPE        = Sql.CreateParameter(cmd, "@LIST_TYPE"       , "string", 255);
			IDbDataParameter parDOMAIN_NAME      = Sql.CreateParameter(cmd, "@DOMAIN_NAME"     , "string", 255);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_Delete(Guid gPROSPECT_LIST_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Delete
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_Delete(Guid gPROSPECT_LIST_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_USERS_Delete
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_USERS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpd";
							else
								cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_USERS_MassUpdate
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_MassUpdate(string sID_LIST, Guid gPROSPECT_LIST_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpd";
				else
					cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_USERS_MassUpdate
		/// <summary>
		/// spPROSPECT_LISTS_USERS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_USERS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpd";
			else
				cmd.CommandText = "spPROSPECT_LISTS_USERS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_Update
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_Update(Guid gPROSPECT_LIST_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECT_LISTS_USERS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECT_LISTS_USERS_Update
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Update
		/// </summary>
		public static void spPROSPECT_LISTS_USERS_Update(Guid gPROSPECT_LIST_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECT_LISTS_USERS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parPROSPECT_LIST_ID = Sql.AddParameter(cmd, "@PROSPECT_LIST_ID", gPROSPECT_LIST_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECT_LISTS_USERS_Update
		/// <summary>
		/// spPROSPECT_LISTS_USERS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECT_LISTS_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECT_LISTS_USERS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parPROSPECT_LIST_ID = Sql.CreateParameter(cmd, "@PROSPECT_LIST_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECTS_Delete
		/// <summary>
		/// spPROSPECTS_Delete
		/// </summary>
		public static void spPROSPECTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECTS_Delete
		/// <summary>
		/// spPROSPECTS_Delete
		/// </summary>
		public static void spPROSPECTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECTS_Delete
		/// <summary>
		/// spPROSPECTS_Delete
		/// </summary>
		public static IDbCommand cmdPROSPECTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECTS_MassDelete
		/// <summary>
		/// spPROSPECTS_MassDelete
		/// </summary>
		public static void spPROSPECTS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECTS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECTS_MassDelete
		/// <summary>
		/// spPROSPECTS_MassDelete
		/// </summary>
		public static void spPROSPECTS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECTS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECTS_MassDelete
		/// <summary>
		/// spPROSPECTS_MassDelete
		/// </summary>
		public static IDbCommand cmdPROSPECTS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECTS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECTS_MassUpdate
		/// </summary>
		public static void spPROSPECTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECTS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECTS_MassUpdate
		/// </summary>
		public static void spPROSPECTS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECTS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdPROSPECTS_MassUpdate
		/// <summary>
		/// spPROSPECTS_MassUpdate
		/// </summary>
		public static IDbCommand cmdPROSPECTS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECTS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spPROSPECTS_New
		/// <summary>
		/// spPROSPECTS_New
		/// </summary>
		public static void spPROSPECTS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECTS_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
							IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
							IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
							IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECTS_New
		/// <summary>
		/// spPROSPECTS_New
		/// </summary>
		public static void spPROSPECTS_New(ref Guid gID, string sFIRST_NAME, string sLAST_NAME, string sPHONE_WORK, string sEMAIL1, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECTS_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFIRST_NAME       = Sql.AddParameter(cmd, "@FIRST_NAME"      , sFIRST_NAME        , 100);
				IDbDataParameter parLAST_NAME        = Sql.AddParameter(cmd, "@LAST_NAME"       , sLAST_NAME         , 100);
				IDbDataParameter parPHONE_WORK       = Sql.AddParameter(cmd, "@PHONE_WORK"      , sPHONE_WORK        ,  25);
				IDbDataParameter parEMAIL1           = Sql.AddParameter(cmd, "@EMAIL1"          , sEMAIL1            , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROSPECTS_New
		/// <summary>
		/// spPROSPECTS_New
		/// </summary>
		public static IDbCommand cmdPROSPECTS_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECTS_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFIRST_NAME       = Sql.CreateParameter(cmd, "@FIRST_NAME"      , "string", 100);
			IDbDataParameter parLAST_NAME        = Sql.CreateParameter(cmd, "@LAST_NAME"       , "string", 100);
			IDbDataParameter parPHONE_WORK       = Sql.CreateParameter(cmd, "@PHONE_WORK"      , "string",  25);
			IDbDataParameter parEMAIL1           = Sql.CreateParameter(cmd, "@EMAIL1"          , "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spPROSPECTS_Update
		/// <summary>
		/// spPROSPECTS_Update
		/// </summary>
		public static void spPROSPECTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sDEPARTMENT, DateTime dtBIRTHDATE, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sASSISTANT, string sASSISTANT_PHONE, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gLEAD_ID, string sACCOUNT_NAME, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spPROSPECTS_Update";
							IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
							IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
							IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
							IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  25);
							IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 255);
							IDbDataParameter parBIRTHDATE                  = Sql.AddParameter(cmd, "@BIRTHDATE"                 , dtBIRTHDATE                  );
							IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
							IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
							IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
							IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
							IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
							IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
							IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
							IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
							IDbDataParameter parASSISTANT                  = Sql.AddParameter(cmd, "@ASSISTANT"                 , sASSISTANT                   ,  75);
							IDbDataParameter parASSISTANT_PHONE            = Sql.AddParameter(cmd, "@ASSISTANT_PHONE"           , sASSISTANT_PHONE             ,  25);
							IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
							IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
							IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
							IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
							IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
							IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
							IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
							IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
							IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
							IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
							IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
							IDbDataParameter parPARENT_TYPE                = Sql.AddParameter(cmd, "@PARENT_TYPE"               , sPARENT_TYPE                 ,  25);
							IDbDataParameter parPARENT_ID                  = Sql.AddParameter(cmd, "@PARENT_ID"                 , gPARENT_ID                   );
							IDbDataParameter parLEAD_ID                    = Sql.AddParameter(cmd, "@LEAD_ID"                   , gLEAD_ID                     );
							IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spPROSPECTS_Update
		/// <summary>
		/// spPROSPECTS_Update
		/// </summary>
		public static void spPROSPECTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sSALUTATION, string sFIRST_NAME, string sLAST_NAME, string sTITLE, string sDEPARTMENT, DateTime dtBIRTHDATE, bool bDO_NOT_CALL, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sASSISTANT, string sASSISTANT_PHONE, bool bEMAIL_OPT_OUT, bool bINVALID_EMAIL, string sPRIMARY_ADDRESS_STREET, string sPRIMARY_ADDRESS_CITY, string sPRIMARY_ADDRESS_STATE, string sPRIMARY_ADDRESS_POSTALCODE, string sPRIMARY_ADDRESS_COUNTRY, string sALT_ADDRESS_STREET, string sALT_ADDRESS_CITY, string sALT_ADDRESS_STATE, string sALT_ADDRESS_POSTALCODE, string sALT_ADDRESS_COUNTRY, string sDESCRIPTION, string sPARENT_TYPE, Guid gPARENT_ID, Guid gLEAD_ID, string sACCOUNT_NAME, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spPROSPECTS_Update";
				IDbDataParameter parID                         = Sql.AddParameter(cmd, "@ID"                        , gID                          );
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parSALUTATION                 = Sql.AddParameter(cmd, "@SALUTATION"                , sSALUTATION                  ,   5);
				IDbDataParameter parFIRST_NAME                 = Sql.AddParameter(cmd, "@FIRST_NAME"                , sFIRST_NAME                  , 100);
				IDbDataParameter parLAST_NAME                  = Sql.AddParameter(cmd, "@LAST_NAME"                 , sLAST_NAME                   , 100);
				IDbDataParameter parTITLE                      = Sql.AddParameter(cmd, "@TITLE"                     , sTITLE                       ,  25);
				IDbDataParameter parDEPARTMENT                 = Sql.AddParameter(cmd, "@DEPARTMENT"                , sDEPARTMENT                  , 255);
				IDbDataParameter parBIRTHDATE                  = Sql.AddParameter(cmd, "@BIRTHDATE"                 , dtBIRTHDATE                  );
				IDbDataParameter parDO_NOT_CALL                = Sql.AddParameter(cmd, "@DO_NOT_CALL"               , bDO_NOT_CALL                 );
				IDbDataParameter parPHONE_HOME                 = Sql.AddParameter(cmd, "@PHONE_HOME"                , sPHONE_HOME                  ,  25);
				IDbDataParameter parPHONE_MOBILE               = Sql.AddParameter(cmd, "@PHONE_MOBILE"              , sPHONE_MOBILE                ,  25);
				IDbDataParameter parPHONE_WORK                 = Sql.AddParameter(cmd, "@PHONE_WORK"                , sPHONE_WORK                  ,  25);
				IDbDataParameter parPHONE_OTHER                = Sql.AddParameter(cmd, "@PHONE_OTHER"               , sPHONE_OTHER                 ,  25);
				IDbDataParameter parPHONE_FAX                  = Sql.AddParameter(cmd, "@PHONE_FAX"                 , sPHONE_FAX                   ,  25);
				IDbDataParameter parEMAIL1                     = Sql.AddParameter(cmd, "@EMAIL1"                    , sEMAIL1                      , 100);
				IDbDataParameter parEMAIL2                     = Sql.AddParameter(cmd, "@EMAIL2"                    , sEMAIL2                      , 100);
				IDbDataParameter parASSISTANT                  = Sql.AddParameter(cmd, "@ASSISTANT"                 , sASSISTANT                   ,  75);
				IDbDataParameter parASSISTANT_PHONE            = Sql.AddParameter(cmd, "@ASSISTANT_PHONE"           , sASSISTANT_PHONE             ,  25);
				IDbDataParameter parEMAIL_OPT_OUT              = Sql.AddParameter(cmd, "@EMAIL_OPT_OUT"             , bEMAIL_OPT_OUT               );
				IDbDataParameter parINVALID_EMAIL              = Sql.AddParameter(cmd, "@INVALID_EMAIL"             , bINVALID_EMAIL               );
				IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , sPRIMARY_ADDRESS_STREET      , 150);
				IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , sPRIMARY_ADDRESS_CITY        , 100);
				IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , sPRIMARY_ADDRESS_STATE       , 100);
				IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", sPRIMARY_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , sPRIMARY_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parALT_ADDRESS_STREET         = Sql.AddParameter(cmd, "@ALT_ADDRESS_STREET"        , sALT_ADDRESS_STREET          , 150);
				IDbDataParameter parALT_ADDRESS_CITY           = Sql.AddParameter(cmd, "@ALT_ADDRESS_CITY"          , sALT_ADDRESS_CITY            , 100);
				IDbDataParameter parALT_ADDRESS_STATE          = Sql.AddParameter(cmd, "@ALT_ADDRESS_STATE"         , sALT_ADDRESS_STATE           , 100);
				IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.AddParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , sALT_ADDRESS_POSTALCODE      ,  20);
				IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.AddParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , sALT_ADDRESS_COUNTRY         , 100);
				IDbDataParameter parDESCRIPTION                = Sql.AddParameter(cmd, "@DESCRIPTION"               , sDESCRIPTION                 );
				IDbDataParameter parPARENT_TYPE                = Sql.AddParameter(cmd, "@PARENT_TYPE"               , sPARENT_TYPE                 ,  25);
				IDbDataParameter parPARENT_ID                  = Sql.AddParameter(cmd, "@PARENT_ID"                 , gPARENT_ID                   );
				IDbDataParameter parLEAD_ID                    = Sql.AddParameter(cmd, "@LEAD_ID"                   , gLEAD_ID                     );
				IDbDataParameter parACCOUNT_NAME               = Sql.AddParameter(cmd, "@ACCOUNT_NAME"              , sACCOUNT_NAME                , 150);
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdPROSPECTS_Update
		/// <summary>
		/// spPROSPECTS_Update
		/// </summary>
		public static IDbCommand cmdPROSPECTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spPROSPECTS_Update";
			IDbDataParameter parID                         = Sql.CreateParameter(cmd, "@ID"                        , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parSALUTATION                 = Sql.CreateParameter(cmd, "@SALUTATION"                , "string",   5);
			IDbDataParameter parFIRST_NAME                 = Sql.CreateParameter(cmd, "@FIRST_NAME"                , "string", 100);
			IDbDataParameter parLAST_NAME                  = Sql.CreateParameter(cmd, "@LAST_NAME"                 , "string", 100);
			IDbDataParameter parTITLE                      = Sql.CreateParameter(cmd, "@TITLE"                     , "string",  25);
			IDbDataParameter parDEPARTMENT                 = Sql.CreateParameter(cmd, "@DEPARTMENT"                , "string", 255);
			IDbDataParameter parBIRTHDATE                  = Sql.CreateParameter(cmd, "@BIRTHDATE"                 , "DateTime",   8);
			IDbDataParameter parDO_NOT_CALL                = Sql.CreateParameter(cmd, "@DO_NOT_CALL"               , "bool",   1);
			IDbDataParameter parPHONE_HOME                 = Sql.CreateParameter(cmd, "@PHONE_HOME"                , "string",  25);
			IDbDataParameter parPHONE_MOBILE               = Sql.CreateParameter(cmd, "@PHONE_MOBILE"              , "string",  25);
			IDbDataParameter parPHONE_WORK                 = Sql.CreateParameter(cmd, "@PHONE_WORK"                , "string",  25);
			IDbDataParameter parPHONE_OTHER                = Sql.CreateParameter(cmd, "@PHONE_OTHER"               , "string",  25);
			IDbDataParameter parPHONE_FAX                  = Sql.CreateParameter(cmd, "@PHONE_FAX"                 , "string",  25);
			IDbDataParameter parEMAIL1                     = Sql.CreateParameter(cmd, "@EMAIL1"                    , "string", 100);
			IDbDataParameter parEMAIL2                     = Sql.CreateParameter(cmd, "@EMAIL2"                    , "string", 100);
			IDbDataParameter parASSISTANT                  = Sql.CreateParameter(cmd, "@ASSISTANT"                 , "string",  75);
			IDbDataParameter parASSISTANT_PHONE            = Sql.CreateParameter(cmd, "@ASSISTANT_PHONE"           , "string",  25);
			IDbDataParameter parEMAIL_OPT_OUT              = Sql.CreateParameter(cmd, "@EMAIL_OPT_OUT"             , "bool",   1);
			IDbDataParameter parINVALID_EMAIL              = Sql.CreateParameter(cmd, "@INVALID_EMAIL"             , "bool",   1);
			IDbDataParameter parPRIMARY_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parPRIMARY_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parPRIMARY_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parPRIMARY_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@PRIMARY_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parALT_ADDRESS_STREET         = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STREET"        , "string", 150);
			IDbDataParameter parALT_ADDRESS_CITY           = Sql.CreateParameter(cmd, "@ALT_ADDRESS_CITY"          , "string", 100);
			IDbDataParameter parALT_ADDRESS_STATE          = Sql.CreateParameter(cmd, "@ALT_ADDRESS_STATE"         , "string", 100);
			IDbDataParameter parALT_ADDRESS_POSTALCODE     = Sql.CreateParameter(cmd, "@ALT_ADDRESS_POSTALCODE"    , "string",  20);
			IDbDataParameter parALT_ADDRESS_COUNTRY        = Sql.CreateParameter(cmd, "@ALT_ADDRESS_COUNTRY"       , "string", 100);
			IDbDataParameter parDESCRIPTION                = Sql.CreateParameter(cmd, "@DESCRIPTION"               , "string", 104857600);
			IDbDataParameter parPARENT_TYPE                = Sql.CreateParameter(cmd, "@PARENT_TYPE"               , "string",  25);
			IDbDataParameter parPARENT_ID                  = Sql.CreateParameter(cmd, "@PARENT_ID"                 , "Guid",  16);
			IDbDataParameter parLEAD_ID                    = Sql.CreateParameter(cmd, "@LEAD_ID"                   , "Guid",  16);
			IDbDataParameter parACCOUNT_NAME               = Sql.CreateParameter(cmd, "@ACCOUNT_NAME"              , "string", 150);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spQUOTES_ACCOUNTS_Delete
		/// <summary>
		/// spQUOTES_ACCOUNTS_Delete
		/// </summary>
		public static void spQUOTES_ACCOUNTS_Delete(Guid gQUOTE_ID, Guid gACCOUNT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_ACCOUNTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_ACCOUNTS_Delete
		/// <summary>
		/// spQUOTES_ACCOUNTS_Delete
		/// </summary>
		public static void spQUOTES_ACCOUNTS_Delete(Guid gQUOTE_ID, Guid gACCOUNT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_ACCOUNTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_ACCOUNTS_Delete
		/// <summary>
		/// spQUOTES_ACCOUNTS_Delete
		/// </summary>
		public static IDbCommand cmdQUOTES_ACCOUNTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_ACCOUNTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_ACCOUNTS_Update
		/// <summary>
		/// spQUOTES_ACCOUNTS_Update
		/// </summary>
		public static void spQUOTES_ACCOUNTS_Update(Guid gQUOTE_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_ACCOUNTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_ACCOUNTS_Update
		/// <summary>
		/// spQUOTES_ACCOUNTS_Update
		/// </summary>
		public static void spQUOTES_ACCOUNTS_Update(Guid gQUOTE_ID, Guid gACCOUNT_ID, string sACCOUNT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_ACCOUNTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parACCOUNT_ROLE     = Sql.AddParameter(cmd, "@ACCOUNT_ROLE"    , sACCOUNT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_ACCOUNTS_Update
		/// <summary>
		/// spQUOTES_ACCOUNTS_Update
		/// </summary>
		public static IDbCommand cmdQUOTES_ACCOUNTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_ACCOUNTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parACCOUNT_ROLE     = Sql.CreateParameter(cmd, "@ACCOUNT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spQUOTES_CONTACTS_Delete
		/// <summary>
		/// spQUOTES_CONTACTS_Delete
		/// </summary>
		public static void spQUOTES_CONTACTS_Delete(Guid gQUOTE_ID, Guid gCONTACT_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_CONTACTS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_CONTACTS_Delete
		/// <summary>
		/// spQUOTES_CONTACTS_Delete
		/// </summary>
		public static void spQUOTES_CONTACTS_Delete(Guid gQUOTE_ID, Guid gCONTACT_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_CONTACTS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_CONTACTS_Delete
		/// <summary>
		/// spQUOTES_CONTACTS_Delete
		/// </summary>
		public static IDbCommand cmdQUOTES_CONTACTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_CONTACTS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_CONTACTS_Update
		/// <summary>
		/// spQUOTES_CONTACTS_Update
		/// </summary>
		public static void spQUOTES_CONTACTS_Update(Guid gQUOTE_ID, Guid gCONTACT_ID, string sCONTACT_ROLE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_CONTACTS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_CONTACTS_Update
		/// <summary>
		/// spQUOTES_CONTACTS_Update
		/// </summary>
		public static void spQUOTES_CONTACTS_Update(Guid gQUOTE_ID, Guid gCONTACT_ID, string sCONTACT_ROLE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_CONTACTS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parCONTACT_ROLE     = Sql.AddParameter(cmd, "@CONTACT_ROLE"    , sCONTACT_ROLE      ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_CONTACTS_Update
		/// <summary>
		/// spQUOTES_CONTACTS_Update
		/// </summary>
		public static IDbCommand cmdQUOTES_CONTACTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_CONTACTS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parCONTACT_ROLE     = Sql.CreateParameter(cmd, "@CONTACT_ROLE"    , "string",  25);
			return cmd;
		}
		#endregion

		#region spQUOTES_Delete
		/// <summary>
		/// spQUOTES_Delete
		/// </summary>
		public static void spQUOTES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_Delete
		/// <summary>
		/// spQUOTES_Delete
		/// </summary>
		public static void spQUOTES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_Delete
		/// <summary>
		/// spQUOTES_Delete
		/// </summary>
		public static IDbCommand cmdQUOTES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_LINE_ITEMS_Delete
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Delete
		/// </summary>
		public static void spQUOTES_LINE_ITEMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_LINE_ITEMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_LINE_ITEMS_Delete
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Delete
		/// </summary>
		public static void spQUOTES_LINE_ITEMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_LINE_ITEMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_LINE_ITEMS_Delete
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Delete
		/// </summary>
		public static IDbCommand cmdQUOTES_LINE_ITEMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_LINE_ITEMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_LINE_ITEMS_Update
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Update
		/// </summary>
		public static void spQUOTES_LINE_ITEMS_Update(ref Guid gID, Guid gQUOTE_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_LINE_ITEMS_Update";
							IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
							IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
							IDbDataParameter parQUOTE_ID            = Sql.AddParameter(cmd, "@QUOTE_ID"           , gQUOTE_ID             );
							IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
							IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
							IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
							IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
							IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
							IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
							IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
							IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
							IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
							IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
							IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
							IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
							IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_LINE_ITEMS_Update
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Update
		/// </summary>
		public static void spQUOTES_LINE_ITEMS_Update(ref Guid gID, Guid gQUOTE_ID, Guid gLINE_GROUP_ID, string sLINE_ITEM_TYPE, Int32 nPOSITION, string sNAME, string sMFT_PART_NUM, string sVENDOR_PART_NUM, Guid gPRODUCT_TEMPLATE_ID, string sTAX_CLASS, Int32 nQUANTITY, decimal dCOST_PRICE, decimal dLIST_PRICE, decimal dUNIT_PRICE, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_LINE_ITEMS_Update";
				IDbDataParameter parID                  = Sql.AddParameter(cmd, "@ID"                 , gID                   );
				IDbDataParameter parMODIFIED_USER_ID    = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"   ,  Security.USER_ID     );
				IDbDataParameter parQUOTE_ID            = Sql.AddParameter(cmd, "@QUOTE_ID"           , gQUOTE_ID             );
				IDbDataParameter parLINE_GROUP_ID       = Sql.AddParameter(cmd, "@LINE_GROUP_ID"      , gLINE_GROUP_ID        );
				IDbDataParameter parLINE_ITEM_TYPE      = Sql.AddParameter(cmd, "@LINE_ITEM_TYPE"     , sLINE_ITEM_TYPE       ,  25);
				IDbDataParameter parPOSITION            = Sql.AddParameter(cmd, "@POSITION"           , nPOSITION             );
				IDbDataParameter parNAME                = Sql.AddParameter(cmd, "@NAME"               , sNAME                 , 100);
				IDbDataParameter parMFT_PART_NUM        = Sql.AddParameter(cmd, "@MFT_PART_NUM"       , sMFT_PART_NUM         ,  50);
				IDbDataParameter parVENDOR_PART_NUM     = Sql.AddParameter(cmd, "@VENDOR_PART_NUM"    , sVENDOR_PART_NUM      ,  50);
				IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.AddParameter(cmd, "@PRODUCT_TEMPLATE_ID", gPRODUCT_TEMPLATE_ID  );
				IDbDataParameter parTAX_CLASS           = Sql.AddParameter(cmd, "@TAX_CLASS"          , sTAX_CLASS            ,  25);
				IDbDataParameter parQUANTITY            = Sql.AddParameter(cmd, "@QUANTITY"           , nQUANTITY             );
				IDbDataParameter parCOST_PRICE          = Sql.AddParameter(cmd, "@COST_PRICE"         , dCOST_PRICE           );
				IDbDataParameter parLIST_PRICE          = Sql.AddParameter(cmd, "@LIST_PRICE"         , dLIST_PRICE           );
				IDbDataParameter parUNIT_PRICE          = Sql.AddParameter(cmd, "@UNIT_PRICE"         , dUNIT_PRICE           );
				IDbDataParameter parDESCRIPTION         = Sql.AddParameter(cmd, "@DESCRIPTION"        , sDESCRIPTION          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdQUOTES_LINE_ITEMS_Update
		/// <summary>
		/// spQUOTES_LINE_ITEMS_Update
		/// </summary>
		public static IDbCommand cmdQUOTES_LINE_ITEMS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_LINE_ITEMS_Update";
			IDbDataParameter parID                  = Sql.CreateParameter(cmd, "@ID"                 , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID    = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"   , "Guid",  16);
			IDbDataParameter parQUOTE_ID            = Sql.CreateParameter(cmd, "@QUOTE_ID"           , "Guid",  16);
			IDbDataParameter parLINE_GROUP_ID       = Sql.CreateParameter(cmd, "@LINE_GROUP_ID"      , "Guid",  16);
			IDbDataParameter parLINE_ITEM_TYPE      = Sql.CreateParameter(cmd, "@LINE_ITEM_TYPE"     , "string",  25);
			IDbDataParameter parPOSITION            = Sql.CreateParameter(cmd, "@POSITION"           , "Int32",   4);
			IDbDataParameter parNAME                = Sql.CreateParameter(cmd, "@NAME"               , "string", 100);
			IDbDataParameter parMFT_PART_NUM        = Sql.CreateParameter(cmd, "@MFT_PART_NUM"       , "string",  50);
			IDbDataParameter parVENDOR_PART_NUM     = Sql.CreateParameter(cmd, "@VENDOR_PART_NUM"    , "string",  50);
			IDbDataParameter parPRODUCT_TEMPLATE_ID = Sql.CreateParameter(cmd, "@PRODUCT_TEMPLATE_ID", "Guid",  16);
			IDbDataParameter parTAX_CLASS           = Sql.CreateParameter(cmd, "@TAX_CLASS"          , "string",  25);
			IDbDataParameter parQUANTITY            = Sql.CreateParameter(cmd, "@QUANTITY"           , "Int32",   4);
			IDbDataParameter parCOST_PRICE          = Sql.CreateParameter(cmd, "@COST_PRICE"         , "decimal",   8);
			IDbDataParameter parLIST_PRICE          = Sql.CreateParameter(cmd, "@LIST_PRICE"         , "decimal",   8);
			IDbDataParameter parUNIT_PRICE          = Sql.CreateParameter(cmd, "@UNIT_PRICE"         , "decimal",   8);
			IDbDataParameter parDESCRIPTION         = Sql.CreateParameter(cmd, "@DESCRIPTION"        , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spQUOTES_MassDelete
		/// <summary>
		/// spQUOTES_MassDelete
		/// </summary>
		public static void spQUOTES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_MassDelete
		/// <summary>
		/// spQUOTES_MassDelete
		/// </summary>
		public static void spQUOTES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_MassDelete
		/// <summary>
		/// spQUOTES_MassDelete
		/// </summary>
		public static IDbCommand cmdQUOTES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_MassUpdate
		/// <summary>
		/// spQUOTES_MassUpdate
		/// </summary>
		public static void spQUOTES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sQUOTE_STAGE, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_QUOTE_EXPECTED_CLOSED, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_MassUpdate";
							IDbDataParameter parID_LIST                    = Sql.AddAnsiParam(cmd, "@ID_LIST"                   , sID_LIST                     , 8000);
							IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
							IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
							IDbDataParameter parPAYMENT_TERMS              = Sql.AddParameter(cmd, "@PAYMENT_TERMS"             , sPAYMENT_TERMS               ,  25);
							IDbDataParameter parQUOTE_STAGE                = Sql.AddParameter(cmd, "@QUOTE_STAGE"               , sQUOTE_STAGE                 ,  25);
							IDbDataParameter parORIGINAL_PO_DATE           = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"          , dtORIGINAL_PO_DATE           );
							IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED = Sql.AddParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED", dtDATE_QUOTE_EXPECTED_CLOSED );
							IDbDataParameter parBILLING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"        , gBILLING_ACCOUNT_ID          );
							IDbDataParameter parBILLING_CONTACT_ID         = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"        , gBILLING_CONTACT_ID          );
							IDbDataParameter parSHIPPING_ACCOUNT_ID        = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"       , gSHIPPING_ACCOUNT_ID         );
							IDbDataParameter parSHIPPING_CONTACT_ID        = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"       , gSHIPPING_CONTACT_ID         );
							IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_MassUpdate
		/// <summary>
		/// spQUOTES_MassUpdate
		/// </summary>
		public static void spQUOTES_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sPAYMENT_TERMS, string sQUOTE_STAGE, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_QUOTE_EXPECTED_CLOSED, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_MassUpdate";
				IDbDataParameter parID_LIST                    = Sql.AddAnsiParam(cmd, "@ID_LIST"                   , sID_LIST                     , 8000);
				IDbDataParameter parMODIFIED_USER_ID           = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"          ,  Security.USER_ID            );
				IDbDataParameter parASSIGNED_USER_ID           = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"          , gASSIGNED_USER_ID            );
				IDbDataParameter parPAYMENT_TERMS              = Sql.AddParameter(cmd, "@PAYMENT_TERMS"             , sPAYMENT_TERMS               ,  25);
				IDbDataParameter parQUOTE_STAGE                = Sql.AddParameter(cmd, "@QUOTE_STAGE"               , sQUOTE_STAGE                 ,  25);
				IDbDataParameter parORIGINAL_PO_DATE           = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"          , dtORIGINAL_PO_DATE           );
				IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED = Sql.AddParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED", dtDATE_QUOTE_EXPECTED_CLOSED );
				IDbDataParameter parBILLING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"        , gBILLING_ACCOUNT_ID          );
				IDbDataParameter parBILLING_CONTACT_ID         = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"        , gBILLING_CONTACT_ID          );
				IDbDataParameter parSHIPPING_ACCOUNT_ID        = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"       , gSHIPPING_ACCOUNT_ID         );
				IDbDataParameter parSHIPPING_CONTACT_ID        = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"       , gSHIPPING_CONTACT_ID         );
				IDbDataParameter parTEAM_ID                    = Sql.AddParameter(cmd, "@TEAM_ID"                   , gTEAM_ID                     );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_MassUpdate
		/// <summary>
		/// spQUOTES_MassUpdate
		/// </summary>
		public static IDbCommand cmdQUOTES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_MassUpdate";
			IDbDataParameter parID_LIST                    = Sql.CreateParameter(cmd, "@ID_LIST"                   , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID           = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"          , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID           = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"          , "Guid",  16);
			IDbDataParameter parPAYMENT_TERMS              = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"             , "string",  25);
			IDbDataParameter parQUOTE_STAGE                = Sql.CreateParameter(cmd, "@QUOTE_STAGE"               , "string",  25);
			IDbDataParameter parORIGINAL_PO_DATE           = Sql.CreateParameter(cmd, "@ORIGINAL_PO_DATE"          , "DateTime",   8);
			IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED = Sql.CreateParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED", "DateTime",   8);
			IDbDataParameter parBILLING_ACCOUNT_ID         = Sql.CreateParameter(cmd, "@BILLING_ACCOUNT_ID"        , "Guid",  16);
			IDbDataParameter parBILLING_CONTACT_ID         = Sql.CreateParameter(cmd, "@BILLING_CONTACT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_ACCOUNT_ID        = Sql.CreateParameter(cmd, "@SHIPPING_ACCOUNT_ID"       , "Guid",  16);
			IDbDataParameter parSHIPPING_CONTACT_ID        = Sql.CreateParameter(cmd, "@SHIPPING_CONTACT_ID"       , "Guid",  16);
			IDbDataParameter parTEAM_ID                    = Sql.CreateParameter(cmd, "@TEAM_ID"                   , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_New
		/// <summary>
		/// spQUOTES_New
		/// </summary>
		public static void spQUOTES_New(ref Guid gID, Guid gACCOUNT_ID, string sNAME, string sQUOTE_STAGE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_New";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parQUOTE_STAGE      = Sql.AddParameter(cmd, "@QUOTE_STAGE"     , sQUOTE_STAGE       ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_New
		/// <summary>
		/// spQUOTES_New
		/// </summary>
		public static void spQUOTES_New(ref Guid gID, Guid gACCOUNT_ID, string sNAME, string sQUOTE_STAGE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_New";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parACCOUNT_ID       = Sql.AddParameter(cmd, "@ACCOUNT_ID"      , gACCOUNT_ID        );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parQUOTE_STAGE      = Sql.AddParameter(cmd, "@QUOTE_STAGE"     , sQUOTE_STAGE       ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdQUOTES_New
		/// <summary>
		/// spQUOTES_New
		/// </summary>
		public static IDbCommand cmdQUOTES_New(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_New";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parACCOUNT_ID       = Sql.CreateParameter(cmd, "@ACCOUNT_ID"      , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parQUOTE_STAGE      = Sql.CreateParameter(cmd, "@QUOTE_STAGE"     , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spQUOTES_OPPORTUNITIES_Delete
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Delete
		/// </summary>
		public static void spQUOTES_OPPORTUNITIES_Delete(Guid gQUOTE_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_OPPORTUNITIES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_OPPORTUNITIES_Delete
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Delete
		/// </summary>
		public static void spQUOTES_OPPORTUNITIES_Delete(Guid gQUOTE_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_OPPORTUNITIES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_OPPORTUNITIES_Delete
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Delete
		/// </summary>
		public static IDbCommand cmdQUOTES_OPPORTUNITIES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_OPPORTUNITIES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_OPPORTUNITIES_Update
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Update
		/// </summary>
		public static void spQUOTES_OPPORTUNITIES_Update(Guid gQUOTE_ID, Guid gOPPORTUNITY_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_OPPORTUNITIES_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
							IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_OPPORTUNITIES_Update
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Update
		/// </summary>
		public static void spQUOTES_OPPORTUNITIES_Update(Guid gQUOTE_ID, Guid gOPPORTUNITY_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_OPPORTUNITIES_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parQUOTE_ID         = Sql.AddParameter(cmd, "@QUOTE_ID"        , gQUOTE_ID          );
				IDbDataParameter parOPPORTUNITY_ID   = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"  , gOPPORTUNITY_ID    );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_OPPORTUNITIES_Update
		/// <summary>
		/// spQUOTES_OPPORTUNITIES_Update
		/// </summary>
		public static IDbCommand cmdQUOTES_OPPORTUNITIES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_OPPORTUNITIES_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parQUOTE_ID         = Sql.CreateParameter(cmd, "@QUOTE_ID"        , "Guid",  16);
			IDbDataParameter parOPPORTUNITY_ID   = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"  , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spQUOTES_Update
		/// <summary>
		/// spQUOTES_Update
		/// </summary>
		public static void spQUOTES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gOPPORTUNITY_ID, string sQUOTE_TYPE, string sPAYMENT_TERMS, string sORDER_STAGE, string sQUOTE_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_QUOTE_CLOSED, DateTime dtDATE_QUOTE_EXPECTED_CLOSED, DateTime dtDATE_ORDER_SHIPPED, bool bSHOW_LINE_NUMS, bool bCALC_GRAND_TOTAL, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_Update";
							IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
							IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
							IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
							IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         ,  50);
							IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
							IDbDataParameter parQUOTE_TYPE                  = Sql.AddParameter(cmd, "@QUOTE_TYPE"                 , sQUOTE_TYPE                   ,  25);
							IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
							IDbDataParameter parORDER_STAGE                 = Sql.AddParameter(cmd, "@ORDER_STAGE"                , sORDER_STAGE                  ,  25);
							IDbDataParameter parQUOTE_STAGE                 = Sql.AddParameter(cmd, "@QUOTE_STAGE"                , sQUOTE_STAGE                  ,  25);
							IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
							IDbDataParameter parORIGINAL_PO_DATE            = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"           , dtORIGINAL_PO_DATE            );
							IDbDataParameter parDATE_QUOTE_CLOSED           = Sql.AddParameter(cmd, "@DATE_QUOTE_CLOSED"          , dtDATE_QUOTE_CLOSED           );
							IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED  = Sql.AddParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED" , dtDATE_QUOTE_EXPECTED_CLOSED  );
							IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED"         , dtDATE_ORDER_SHIPPED          );
							IDbDataParameter parSHOW_LINE_NUMS              = Sql.AddParameter(cmd, "@SHOW_LINE_NUMS"             , bSHOW_LINE_NUMS               );
							IDbDataParameter parCALC_GRAND_TOTAL            = Sql.AddParameter(cmd, "@CALC_GRAND_TOTAL"           , bCALC_GRAND_TOTAL             );
							IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
							IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
							IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
							IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
							IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
							IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
							IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
							IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
							IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
							IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
							IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
							IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
							IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
							IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
							IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
							IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
							IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
							IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
							IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
							IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
							IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
							IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
							IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
							IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
							IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_Update
		/// <summary>
		/// spQUOTES_Update
		/// </summary>
		public static void spQUOTES_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, Guid gOPPORTUNITY_ID, string sQUOTE_TYPE, string sPAYMENT_TERMS, string sORDER_STAGE, string sQUOTE_STAGE, string sPURCHASE_ORDER_NUM, DateTime dtORIGINAL_PO_DATE, DateTime dtDATE_QUOTE_CLOSED, DateTime dtDATE_QUOTE_EXPECTED_CLOSED, DateTime dtDATE_ORDER_SHIPPED, bool bSHOW_LINE_NUMS, bool bCALC_GRAND_TOTAL, float flEXCHANGE_RATE, Guid gCURRENCY_ID, Guid gTAXRATE_ID, Guid gSHIPPER_ID, decimal dSUBTOTAL, decimal dDISCOUNT, decimal dSHIPPING, decimal dTAX, decimal dTOTAL, Guid gBILLING_ACCOUNT_ID, Guid gBILLING_CONTACT_ID, string sBILLING_ADDRESS_STREET, string sBILLING_ADDRESS_CITY, string sBILLING_ADDRESS_STATE, string sBILLING_ADDRESS_POSTALCODE, string sBILLING_ADDRESS_COUNTRY, Guid gSHIPPING_ACCOUNT_ID, Guid gSHIPPING_CONTACT_ID, string sSHIPPING_ADDRESS_STREET, string sSHIPPING_ADDRESS_CITY, string sSHIPPING_ADDRESS_STATE, string sSHIPPING_ADDRESS_POSTALCODE, string sSHIPPING_ADDRESS_COUNTRY, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_Update";
				IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
				IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
				IDbDataParameter parASSIGNED_USER_ID            = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID"           , gASSIGNED_USER_ID             );
				IDbDataParameter parNAME                        = Sql.AddParameter(cmd, "@NAME"                       , sNAME                         ,  50);
				IDbDataParameter parOPPORTUNITY_ID              = Sql.AddParameter(cmd, "@OPPORTUNITY_ID"             , gOPPORTUNITY_ID               );
				IDbDataParameter parQUOTE_TYPE                  = Sql.AddParameter(cmd, "@QUOTE_TYPE"                 , sQUOTE_TYPE                   ,  25);
				IDbDataParameter parPAYMENT_TERMS               = Sql.AddParameter(cmd, "@PAYMENT_TERMS"              , sPAYMENT_TERMS                ,  25);
				IDbDataParameter parORDER_STAGE                 = Sql.AddParameter(cmd, "@ORDER_STAGE"                , sORDER_STAGE                  ,  25);
				IDbDataParameter parQUOTE_STAGE                 = Sql.AddParameter(cmd, "@QUOTE_STAGE"                , sQUOTE_STAGE                  ,  25);
				IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.AddParameter(cmd, "@PURCHASE_ORDER_NUM"         , sPURCHASE_ORDER_NUM           ,  50);
				IDbDataParameter parORIGINAL_PO_DATE            = Sql.AddParameter(cmd, "@ORIGINAL_PO_DATE"           , dtORIGINAL_PO_DATE            );
				IDbDataParameter parDATE_QUOTE_CLOSED           = Sql.AddParameter(cmd, "@DATE_QUOTE_CLOSED"          , dtDATE_QUOTE_CLOSED           );
				IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED  = Sql.AddParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED" , dtDATE_QUOTE_EXPECTED_CLOSED  );
				IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.AddParameter(cmd, "@DATE_ORDER_SHIPPED"         , dtDATE_ORDER_SHIPPED          );
				IDbDataParameter parSHOW_LINE_NUMS              = Sql.AddParameter(cmd, "@SHOW_LINE_NUMS"             , bSHOW_LINE_NUMS               );
				IDbDataParameter parCALC_GRAND_TOTAL            = Sql.AddParameter(cmd, "@CALC_GRAND_TOTAL"           , bCALC_GRAND_TOTAL             );
				IDbDataParameter parEXCHANGE_RATE               = Sql.AddParameter(cmd, "@EXCHANGE_RATE"              , flEXCHANGE_RATE               );
				IDbDataParameter parCURRENCY_ID                 = Sql.AddParameter(cmd, "@CURRENCY_ID"                , gCURRENCY_ID                  );
				IDbDataParameter parTAXRATE_ID                  = Sql.AddParameter(cmd, "@TAXRATE_ID"                 , gTAXRATE_ID                   );
				IDbDataParameter parSHIPPER_ID                  = Sql.AddParameter(cmd, "@SHIPPER_ID"                 , gSHIPPER_ID                   );
				IDbDataParameter parSUBTOTAL                    = Sql.AddParameter(cmd, "@SUBTOTAL"                   , dSUBTOTAL                     );
				IDbDataParameter parDISCOUNT                    = Sql.AddParameter(cmd, "@DISCOUNT"                   , dDISCOUNT                     );
				IDbDataParameter parSHIPPING                    = Sql.AddParameter(cmd, "@SHIPPING"                   , dSHIPPING                     );
				IDbDataParameter parTAX                         = Sql.AddParameter(cmd, "@TAX"                        , dTAX                          );
				IDbDataParameter parTOTAL                       = Sql.AddParameter(cmd, "@TOTAL"                      , dTOTAL                        );
				IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.AddParameter(cmd, "@BILLING_ACCOUNT_ID"         , gBILLING_ACCOUNT_ID           );
				IDbDataParameter parBILLING_CONTACT_ID          = Sql.AddParameter(cmd, "@BILLING_CONTACT_ID"         , gBILLING_CONTACT_ID           );
				IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STREET"     , sBILLING_ADDRESS_STREET       , 150);
				IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.AddParameter(cmd, "@BILLING_ADDRESS_CITY"       , sBILLING_ADDRESS_CITY         , 100);
				IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.AddParameter(cmd, "@BILLING_ADDRESS_STATE"      , sBILLING_ADDRESS_STATE        , 100);
				IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.AddParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , sBILLING_ADDRESS_POSTALCODE   ,  20);
				IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.AddParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , sBILLING_ADDRESS_COUNTRY      , 100);
				IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.AddParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , gSHIPPING_ACCOUNT_ID          );
				IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.AddParameter(cmd, "@SHIPPING_CONTACT_ID"        , gSHIPPING_CONTACT_ID          );
				IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , sSHIPPING_ADDRESS_STREET      , 150);
				IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , sSHIPPING_ADDRESS_CITY        , 100);
				IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , sSHIPPING_ADDRESS_STATE       , 100);
				IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", sSHIPPING_ADDRESS_POSTALCODE  ,  20);
				IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.AddParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , sSHIPPING_ADDRESS_COUNTRY     , 100);
				IDbDataParameter parDESCRIPTION                 = Sql.AddParameter(cmd, "@DESCRIPTION"                , sDESCRIPTION                  );
				IDbDataParameter parTEAM_ID                     = Sql.AddParameter(cmd, "@TEAM_ID"                    , gTEAM_ID                      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdQUOTES_Update
		/// <summary>
		/// spQUOTES_Update
		/// </summary>
		public static IDbCommand cmdQUOTES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_Update";
			IDbDataParameter parID                          = Sql.CreateParameter(cmd, "@ID"                         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID            = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"           , "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID            = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID"           , "Guid",  16);
			IDbDataParameter parNAME                        = Sql.CreateParameter(cmd, "@NAME"                       , "string",  50);
			IDbDataParameter parOPPORTUNITY_ID              = Sql.CreateParameter(cmd, "@OPPORTUNITY_ID"             , "Guid",  16);
			IDbDataParameter parQUOTE_TYPE                  = Sql.CreateParameter(cmd, "@QUOTE_TYPE"                 , "string",  25);
			IDbDataParameter parPAYMENT_TERMS               = Sql.CreateParameter(cmd, "@PAYMENT_TERMS"              , "string",  25);
			IDbDataParameter parORDER_STAGE                 = Sql.CreateParameter(cmd, "@ORDER_STAGE"                , "string",  25);
			IDbDataParameter parQUOTE_STAGE                 = Sql.CreateParameter(cmd, "@QUOTE_STAGE"                , "string",  25);
			IDbDataParameter parPURCHASE_ORDER_NUM          = Sql.CreateParameter(cmd, "@PURCHASE_ORDER_NUM"         , "string",  50);
			IDbDataParameter parORIGINAL_PO_DATE            = Sql.CreateParameter(cmd, "@ORIGINAL_PO_DATE"           , "DateTime",   8);
			IDbDataParameter parDATE_QUOTE_CLOSED           = Sql.CreateParameter(cmd, "@DATE_QUOTE_CLOSED"          , "DateTime",   8);
			IDbDataParameter parDATE_QUOTE_EXPECTED_CLOSED  = Sql.CreateParameter(cmd, "@DATE_QUOTE_EXPECTED_CLOSED" , "DateTime",   8);
			IDbDataParameter parDATE_ORDER_SHIPPED          = Sql.CreateParameter(cmd, "@DATE_ORDER_SHIPPED"         , "DateTime",   8);
			IDbDataParameter parSHOW_LINE_NUMS              = Sql.CreateParameter(cmd, "@SHOW_LINE_NUMS"             , "bool",   1);
			IDbDataParameter parCALC_GRAND_TOTAL            = Sql.CreateParameter(cmd, "@CALC_GRAND_TOTAL"           , "bool",   1);
			IDbDataParameter parEXCHANGE_RATE               = Sql.CreateParameter(cmd, "@EXCHANGE_RATE"              , "float",   8);
			IDbDataParameter parCURRENCY_ID                 = Sql.CreateParameter(cmd, "@CURRENCY_ID"                , "Guid",  16);
			IDbDataParameter parTAXRATE_ID                  = Sql.CreateParameter(cmd, "@TAXRATE_ID"                 , "Guid",  16);
			IDbDataParameter parSHIPPER_ID                  = Sql.CreateParameter(cmd, "@SHIPPER_ID"                 , "Guid",  16);
			IDbDataParameter parSUBTOTAL                    = Sql.CreateParameter(cmd, "@SUBTOTAL"                   , "decimal",   8);
			IDbDataParameter parDISCOUNT                    = Sql.CreateParameter(cmd, "@DISCOUNT"                   , "decimal",   8);
			IDbDataParameter parSHIPPING                    = Sql.CreateParameter(cmd, "@SHIPPING"                   , "decimal",   8);
			IDbDataParameter parTAX                         = Sql.CreateParameter(cmd, "@TAX"                        , "decimal",   8);
			IDbDataParameter parTOTAL                       = Sql.CreateParameter(cmd, "@TOTAL"                      , "decimal",   8);
			IDbDataParameter parBILLING_ACCOUNT_ID          = Sql.CreateParameter(cmd, "@BILLING_ACCOUNT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_CONTACT_ID          = Sql.CreateParameter(cmd, "@BILLING_CONTACT_ID"         , "Guid",  16);
			IDbDataParameter parBILLING_ADDRESS_STREET      = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STREET"     , "string", 150);
			IDbDataParameter parBILLING_ADDRESS_CITY        = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_CITY"       , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_STATE       = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_STATE"      , "string", 100);
			IDbDataParameter parBILLING_ADDRESS_POSTALCODE  = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_POSTALCODE" , "string",  20);
			IDbDataParameter parBILLING_ADDRESS_COUNTRY     = Sql.CreateParameter(cmd, "@BILLING_ADDRESS_COUNTRY"    , "string", 100);
			IDbDataParameter parSHIPPING_ACCOUNT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_ACCOUNT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_CONTACT_ID         = Sql.CreateParameter(cmd, "@SHIPPING_CONTACT_ID"        , "Guid",  16);
			IDbDataParameter parSHIPPING_ADDRESS_STREET     = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STREET"    , "string", 150);
			IDbDataParameter parSHIPPING_ADDRESS_CITY       = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_CITY"      , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_STATE      = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_STATE"     , "string", 100);
			IDbDataParameter parSHIPPING_ADDRESS_POSTALCODE = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_POSTALCODE", "string",  20);
			IDbDataParameter parSHIPPING_ADDRESS_COUNTRY    = Sql.CreateParameter(cmd, "@SHIPPING_ADDRESS_COUNTRY"   , "string", 100);
			IDbDataParameter parDESCRIPTION                 = Sql.CreateParameter(cmd, "@DESCRIPTION"                , "string", 104857600);
			IDbDataParameter parTEAM_ID                     = Sql.CreateParameter(cmd, "@TEAM_ID"                    , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spQUOTES_UpdateTotals
		/// <summary>
		/// spQUOTES_UpdateTotals
		/// </summary>
		public static void spQUOTES_UpdateTotals(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spQUOTES_UpdateTotals";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spQUOTES_UpdateTotals
		/// <summary>
		/// spQUOTES_UpdateTotals
		/// </summary>
		public static void spQUOTES_UpdateTotals(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spQUOTES_UpdateTotals";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdQUOTES_UpdateTotals
		/// <summary>
		/// spQUOTES_UpdateTotals
		/// </summary>
		public static IDbCommand cmdQUOTES_UpdateTotals(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spQUOTES_UpdateTotals";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spRELATIONSHIPS_Delete
		/// <summary>
		/// spRELATIONSHIPS_Delete
		/// </summary>
		public static void spRELATIONSHIPS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELATIONSHIPS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELATIONSHIPS_Delete
		/// <summary>
		/// spRELATIONSHIPS_Delete
		/// </summary>
		public static void spRELATIONSHIPS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELATIONSHIPS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdRELATIONSHIPS_Delete
		/// <summary>
		/// spRELATIONSHIPS_Delete
		/// </summary>
		public static IDbCommand cmdRELATIONSHIPS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELATIONSHIPS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spRELATIONSHIPS_InsertOnly
		/// <summary>
		/// spRELATIONSHIPS_InsertOnly
		/// </summary>
		public static void spRELATIONSHIPS_InsertOnly(string sRELATIONSHIP_NAME, string sLHS_MODULE, string sLHS_TABLE, string sLHS_KEY, string sRHS_MODULE, string sRHS_TABLE, string sRHS_KEY, string sJOIN_TABLE, string sJOIN_KEY_LHS, string sJOIN_KEY_RHS, string sRELATIONSHIP_TYPE, string sRELATIONSHIP_ROLE_COLUMN, string sRELATIONSHIP_ROLE_COL_VALUE, bool bREVERSE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELATIONSHIPS_InsertOnly";
							IDbDataParameter parRELATIONSHIP_NAME           = Sql.AddParameter(cmd, "@RELATIONSHIP_NAME"          , sRELATIONSHIP_NAME            , 150);
							IDbDataParameter parLHS_MODULE                  = Sql.AddParameter(cmd, "@LHS_MODULE"                 , sLHS_MODULE                   , 100);
							IDbDataParameter parLHS_TABLE                   = Sql.AddParameter(cmd, "@LHS_TABLE"                  , sLHS_TABLE                    ,  64);
							IDbDataParameter parLHS_KEY                     = Sql.AddParameter(cmd, "@LHS_KEY"                    , sLHS_KEY                      ,  64);
							IDbDataParameter parRHS_MODULE                  = Sql.AddParameter(cmd, "@RHS_MODULE"                 , sRHS_MODULE                   , 100);
							IDbDataParameter parRHS_TABLE                   = Sql.AddParameter(cmd, "@RHS_TABLE"                  , sRHS_TABLE                    ,  64);
							IDbDataParameter parRHS_KEY                     = Sql.AddParameter(cmd, "@RHS_KEY"                    , sRHS_KEY                      ,  64);
							IDbDataParameter parJOIN_TABLE                  = Sql.AddParameter(cmd, "@JOIN_TABLE"                 , sJOIN_TABLE                   ,  64);
							IDbDataParameter parJOIN_KEY_LHS                = Sql.AddParameter(cmd, "@JOIN_KEY_LHS"               , sJOIN_KEY_LHS                 ,  64);
							IDbDataParameter parJOIN_KEY_RHS                = Sql.AddParameter(cmd, "@JOIN_KEY_RHS"               , sJOIN_KEY_RHS                 ,  64);
							IDbDataParameter parRELATIONSHIP_TYPE           = Sql.AddParameter(cmd, "@RELATIONSHIP_TYPE"          , sRELATIONSHIP_TYPE            ,  64);
							IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , sRELATIONSHIP_ROLE_COLUMN     ,  64);
							IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", sRELATIONSHIP_ROLE_COL_VALUE  ,  50);
							IDbDataParameter parREVERSE                     = Sql.AddParameter(cmd, "@REVERSE"                    , bREVERSE                      );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELATIONSHIPS_InsertOnly
		/// <summary>
		/// spRELATIONSHIPS_InsertOnly
		/// </summary>
		public static void spRELATIONSHIPS_InsertOnly(string sRELATIONSHIP_NAME, string sLHS_MODULE, string sLHS_TABLE, string sLHS_KEY, string sRHS_MODULE, string sRHS_TABLE, string sRHS_KEY, string sJOIN_TABLE, string sJOIN_KEY_LHS, string sJOIN_KEY_RHS, string sRELATIONSHIP_TYPE, string sRELATIONSHIP_ROLE_COLUMN, string sRELATIONSHIP_ROLE_COL_VALUE, bool bREVERSE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELATIONSHIPS_InsertOnly";
				IDbDataParameter parRELATIONSHIP_NAME           = Sql.AddParameter(cmd, "@RELATIONSHIP_NAME"          , sRELATIONSHIP_NAME            , 150);
				IDbDataParameter parLHS_MODULE                  = Sql.AddParameter(cmd, "@LHS_MODULE"                 , sLHS_MODULE                   , 100);
				IDbDataParameter parLHS_TABLE                   = Sql.AddParameter(cmd, "@LHS_TABLE"                  , sLHS_TABLE                    ,  64);
				IDbDataParameter parLHS_KEY                     = Sql.AddParameter(cmd, "@LHS_KEY"                    , sLHS_KEY                      ,  64);
				IDbDataParameter parRHS_MODULE                  = Sql.AddParameter(cmd, "@RHS_MODULE"                 , sRHS_MODULE                   , 100);
				IDbDataParameter parRHS_TABLE                   = Sql.AddParameter(cmd, "@RHS_TABLE"                  , sRHS_TABLE                    ,  64);
				IDbDataParameter parRHS_KEY                     = Sql.AddParameter(cmd, "@RHS_KEY"                    , sRHS_KEY                      ,  64);
				IDbDataParameter parJOIN_TABLE                  = Sql.AddParameter(cmd, "@JOIN_TABLE"                 , sJOIN_TABLE                   ,  64);
				IDbDataParameter parJOIN_KEY_LHS                = Sql.AddParameter(cmd, "@JOIN_KEY_LHS"               , sJOIN_KEY_LHS                 ,  64);
				IDbDataParameter parJOIN_KEY_RHS                = Sql.AddParameter(cmd, "@JOIN_KEY_RHS"               , sJOIN_KEY_RHS                 ,  64);
				IDbDataParameter parRELATIONSHIP_TYPE           = Sql.AddParameter(cmd, "@RELATIONSHIP_TYPE"          , sRELATIONSHIP_TYPE            ,  64);
				IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , sRELATIONSHIP_ROLE_COLUMN     ,  64);
				IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", sRELATIONSHIP_ROLE_COL_VALUE  ,  50);
				IDbDataParameter parREVERSE                     = Sql.AddParameter(cmd, "@REVERSE"                    , bREVERSE                      );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdRELATIONSHIPS_InsertOnly
		/// <summary>
		/// spRELATIONSHIPS_InsertOnly
		/// </summary>
		public static IDbCommand cmdRELATIONSHIPS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELATIONSHIPS_InsertOnly";
			IDbDataParameter parRELATIONSHIP_NAME           = Sql.CreateParameter(cmd, "@RELATIONSHIP_NAME"          , "string", 150);
			IDbDataParameter parLHS_MODULE                  = Sql.CreateParameter(cmd, "@LHS_MODULE"                 , "string", 100);
			IDbDataParameter parLHS_TABLE                   = Sql.CreateParameter(cmd, "@LHS_TABLE"                  , "string",  64);
			IDbDataParameter parLHS_KEY                     = Sql.CreateParameter(cmd, "@LHS_KEY"                    , "string",  64);
			IDbDataParameter parRHS_MODULE                  = Sql.CreateParameter(cmd, "@RHS_MODULE"                 , "string", 100);
			IDbDataParameter parRHS_TABLE                   = Sql.CreateParameter(cmd, "@RHS_TABLE"                  , "string",  64);
			IDbDataParameter parRHS_KEY                     = Sql.CreateParameter(cmd, "@RHS_KEY"                    , "string",  64);
			IDbDataParameter parJOIN_TABLE                  = Sql.CreateParameter(cmd, "@JOIN_TABLE"                 , "string",  64);
			IDbDataParameter parJOIN_KEY_LHS                = Sql.CreateParameter(cmd, "@JOIN_KEY_LHS"               , "string",  64);
			IDbDataParameter parJOIN_KEY_RHS                = Sql.CreateParameter(cmd, "@JOIN_KEY_RHS"               , "string",  64);
			IDbDataParameter parRELATIONSHIP_TYPE           = Sql.CreateParameter(cmd, "@RELATIONSHIP_TYPE"          , "string",  64);
			IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.CreateParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , "string",  64);
			IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.CreateParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", "string",  50);
			IDbDataParameter parREVERSE                     = Sql.CreateParameter(cmd, "@REVERSE"                    , "bool",   1);
			return cmd;
		}
		#endregion

		#region spRELATIONSHIPS_Update
		/// <summary>
		/// spRELATIONSHIPS_Update
		/// </summary>
		public static void spRELATIONSHIPS_Update(ref Guid gID, string sRELATIONSHIP_NAME, string sLHS_MODULE, string sLHS_TABLE, string sLHS_KEY, string sRHS_MODULE, string sRHS_TABLE, string sRHS_KEY, string sJOIN_TABLE, string sJOIN_KEY_LHS, string sJOIN_KEY_RHS, string sRELATIONSHIP_TYPE, string sRELATIONSHIP_ROLE_COLUMN, string sRELATIONSHIP_ROLE_COL_VALUE, bool bREVERSE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELATIONSHIPS_Update";
							IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
							IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
							IDbDataParameter parRELATIONSHIP_NAME           = Sql.AddParameter(cmd, "@RELATIONSHIP_NAME"          , sRELATIONSHIP_NAME            , 150);
							IDbDataParameter parLHS_MODULE                  = Sql.AddParameter(cmd, "@LHS_MODULE"                 , sLHS_MODULE                   , 100);
							IDbDataParameter parLHS_TABLE                   = Sql.AddParameter(cmd, "@LHS_TABLE"                  , sLHS_TABLE                    ,  64);
							IDbDataParameter parLHS_KEY                     = Sql.AddParameter(cmd, "@LHS_KEY"                    , sLHS_KEY                      ,  64);
							IDbDataParameter parRHS_MODULE                  = Sql.AddParameter(cmd, "@RHS_MODULE"                 , sRHS_MODULE                   , 100);
							IDbDataParameter parRHS_TABLE                   = Sql.AddParameter(cmd, "@RHS_TABLE"                  , sRHS_TABLE                    ,  64);
							IDbDataParameter parRHS_KEY                     = Sql.AddParameter(cmd, "@RHS_KEY"                    , sRHS_KEY                      ,  64);
							IDbDataParameter parJOIN_TABLE                  = Sql.AddParameter(cmd, "@JOIN_TABLE"                 , sJOIN_TABLE                   ,  64);
							IDbDataParameter parJOIN_KEY_LHS                = Sql.AddParameter(cmd, "@JOIN_KEY_LHS"               , sJOIN_KEY_LHS                 ,  64);
							IDbDataParameter parJOIN_KEY_RHS                = Sql.AddParameter(cmd, "@JOIN_KEY_RHS"               , sJOIN_KEY_RHS                 ,  64);
							IDbDataParameter parRELATIONSHIP_TYPE           = Sql.AddParameter(cmd, "@RELATIONSHIP_TYPE"          , sRELATIONSHIP_TYPE            ,  64);
							IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , sRELATIONSHIP_ROLE_COLUMN     ,  64);
							IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", sRELATIONSHIP_ROLE_COL_VALUE  ,  50);
							IDbDataParameter parREVERSE                     = Sql.AddParameter(cmd, "@REVERSE"                    , bREVERSE                      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELATIONSHIPS_Update
		/// <summary>
		/// spRELATIONSHIPS_Update
		/// </summary>
		public static void spRELATIONSHIPS_Update(ref Guid gID, string sRELATIONSHIP_NAME, string sLHS_MODULE, string sLHS_TABLE, string sLHS_KEY, string sRHS_MODULE, string sRHS_TABLE, string sRHS_KEY, string sJOIN_TABLE, string sJOIN_KEY_LHS, string sJOIN_KEY_RHS, string sRELATIONSHIP_TYPE, string sRELATIONSHIP_ROLE_COLUMN, string sRELATIONSHIP_ROLE_COL_VALUE, bool bREVERSE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELATIONSHIPS_Update";
				IDbDataParameter parID                          = Sql.AddParameter(cmd, "@ID"                         , gID                           );
				IDbDataParameter parMODIFIED_USER_ID            = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"           ,  Security.USER_ID             );
				IDbDataParameter parRELATIONSHIP_NAME           = Sql.AddParameter(cmd, "@RELATIONSHIP_NAME"          , sRELATIONSHIP_NAME            , 150);
				IDbDataParameter parLHS_MODULE                  = Sql.AddParameter(cmd, "@LHS_MODULE"                 , sLHS_MODULE                   , 100);
				IDbDataParameter parLHS_TABLE                   = Sql.AddParameter(cmd, "@LHS_TABLE"                  , sLHS_TABLE                    ,  64);
				IDbDataParameter parLHS_KEY                     = Sql.AddParameter(cmd, "@LHS_KEY"                    , sLHS_KEY                      ,  64);
				IDbDataParameter parRHS_MODULE                  = Sql.AddParameter(cmd, "@RHS_MODULE"                 , sRHS_MODULE                   , 100);
				IDbDataParameter parRHS_TABLE                   = Sql.AddParameter(cmd, "@RHS_TABLE"                  , sRHS_TABLE                    ,  64);
				IDbDataParameter parRHS_KEY                     = Sql.AddParameter(cmd, "@RHS_KEY"                    , sRHS_KEY                      ,  64);
				IDbDataParameter parJOIN_TABLE                  = Sql.AddParameter(cmd, "@JOIN_TABLE"                 , sJOIN_TABLE                   ,  64);
				IDbDataParameter parJOIN_KEY_LHS                = Sql.AddParameter(cmd, "@JOIN_KEY_LHS"               , sJOIN_KEY_LHS                 ,  64);
				IDbDataParameter parJOIN_KEY_RHS                = Sql.AddParameter(cmd, "@JOIN_KEY_RHS"               , sJOIN_KEY_RHS                 ,  64);
				IDbDataParameter parRELATIONSHIP_TYPE           = Sql.AddParameter(cmd, "@RELATIONSHIP_TYPE"          , sRELATIONSHIP_TYPE            ,  64);
				IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , sRELATIONSHIP_ROLE_COLUMN     ,  64);
				IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.AddParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", sRELATIONSHIP_ROLE_COL_VALUE  ,  50);
				IDbDataParameter parREVERSE                     = Sql.AddParameter(cmd, "@REVERSE"                    , bREVERSE                      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdRELATIONSHIPS_Update
		/// <summary>
		/// spRELATIONSHIPS_Update
		/// </summary>
		public static IDbCommand cmdRELATIONSHIPS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELATIONSHIPS_Update";
			IDbDataParameter parID                          = Sql.CreateParameter(cmd, "@ID"                         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID            = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"           , "Guid",  16);
			IDbDataParameter parRELATIONSHIP_NAME           = Sql.CreateParameter(cmd, "@RELATIONSHIP_NAME"          , "string", 150);
			IDbDataParameter parLHS_MODULE                  = Sql.CreateParameter(cmd, "@LHS_MODULE"                 , "string", 100);
			IDbDataParameter parLHS_TABLE                   = Sql.CreateParameter(cmd, "@LHS_TABLE"                  , "string",  64);
			IDbDataParameter parLHS_KEY                     = Sql.CreateParameter(cmd, "@LHS_KEY"                    , "string",  64);
			IDbDataParameter parRHS_MODULE                  = Sql.CreateParameter(cmd, "@RHS_MODULE"                 , "string", 100);
			IDbDataParameter parRHS_TABLE                   = Sql.CreateParameter(cmd, "@RHS_TABLE"                  , "string",  64);
			IDbDataParameter parRHS_KEY                     = Sql.CreateParameter(cmd, "@RHS_KEY"                    , "string",  64);
			IDbDataParameter parJOIN_TABLE                  = Sql.CreateParameter(cmd, "@JOIN_TABLE"                 , "string",  64);
			IDbDataParameter parJOIN_KEY_LHS                = Sql.CreateParameter(cmd, "@JOIN_KEY_LHS"               , "string",  64);
			IDbDataParameter parJOIN_KEY_RHS                = Sql.CreateParameter(cmd, "@JOIN_KEY_RHS"               , "string",  64);
			IDbDataParameter parRELATIONSHIP_TYPE           = Sql.CreateParameter(cmd, "@RELATIONSHIP_TYPE"          , "string",  64);
			IDbDataParameter parRELATIONSHIP_ROLE_COLUMN    = Sql.CreateParameter(cmd, "@RELATIONSHIP_ROLE_COLUMN"   , "string",  64);
			IDbDataParameter parRELATIONSHIP_ROLE_COL_VALUE = Sql.CreateParameter(cmd, "@RELATIONSHIP_ROLE_COL_VALUE", "string",  50);
			IDbDataParameter parREVERSE                     = Sql.CreateParameter(cmd, "@REVERSE"                    , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spRELEASES_Delete
		/// <summary>
		/// spRELEASES_Delete
		/// </summary>
		public static void spRELEASES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELEASES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELEASES_Delete
		/// <summary>
		/// spRELEASES_Delete
		/// </summary>
		public static void spRELEASES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELEASES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdRELEASES_Delete
		/// <summary>
		/// spRELEASES_Delete
		/// </summary>
		public static IDbCommand cmdRELEASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELEASES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spRELEASES_MassDelete
		/// <summary>
		/// spRELEASES_MassDelete
		/// </summary>
		public static void spRELEASES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELEASES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELEASES_MassDelete
		/// <summary>
		/// spRELEASES_MassDelete
		/// </summary>
		public static void spRELEASES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELEASES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdRELEASES_MassDelete
		/// <summary>
		/// spRELEASES_MassDelete
		/// </summary>
		public static IDbCommand cmdRELEASES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELEASES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spRELEASES_MassUpdate
		/// <summary>
		/// spRELEASES_MassUpdate
		/// </summary>
		public static void spRELEASES_MassUpdate(string sID_LIST, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELEASES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELEASES_MassUpdate
		/// <summary>
		/// spRELEASES_MassUpdate
		/// </summary>
		public static void spRELEASES_MassUpdate(string sID_LIST, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELEASES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdRELEASES_MassUpdate
		/// <summary>
		/// spRELEASES_MassUpdate
		/// </summary>
		public static IDbCommand cmdRELEASES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELEASES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			return cmd;
		}
		#endregion

		#region spRELEASES_Update
		/// <summary>
		/// spRELEASES_Update
		/// </summary>
		public static void spRELEASES_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spRELEASES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spRELEASES_Update
		/// <summary>
		/// spRELEASES_Update
		/// </summary>
		public static void spRELEASES_Update(ref Guid gID, string sNAME, Int32 nLIST_ORDER, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spRELEASES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdRELEASES_Update
		/// <summary>
		/// spRELEASES_Update
		/// </summary>
		public static IDbCommand cmdRELEASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spRELEASES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spREPORTS_Delete
		/// <summary>
		/// spREPORTS_Delete
		/// </summary>
		public static void spREPORTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spREPORTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spREPORTS_Delete
		/// <summary>
		/// spREPORTS_Delete
		/// </summary>
		public static void spREPORTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spREPORTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdREPORTS_Delete
		/// <summary>
		/// spREPORTS_Delete
		/// </summary>
		public static IDbCommand cmdREPORTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spREPORTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spREPORTS_Publish
		/// <summary>
		/// spREPORTS_Publish
		/// </summary>
		public static void spREPORTS_Publish(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spREPORTS_Publish";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spREPORTS_Publish
		/// <summary>
		/// spREPORTS_Publish
		/// </summary>
		public static void spREPORTS_Publish(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spREPORTS_Publish";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdREPORTS_Publish
		/// <summary>
		/// spREPORTS_Publish
		/// </summary>
		public static IDbCommand cmdREPORTS_Publish(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spREPORTS_Publish";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spREPORTS_Unpublish
		/// <summary>
		/// spREPORTS_Unpublish
		/// </summary>
		public static void spREPORTS_Unpublish(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spREPORTS_Unpublish";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spREPORTS_Unpublish
		/// <summary>
		/// spREPORTS_Unpublish
		/// </summary>
		public static void spREPORTS_Unpublish(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spREPORTS_Unpublish";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdREPORTS_Unpublish
		/// <summary>
		/// spREPORTS_Unpublish
		/// </summary>
		public static IDbCommand cmdREPORTS_Unpublish(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spREPORTS_Unpublish";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spREPORTS_Update
		/// <summary>
		/// spREPORTS_Update
		/// </summary>
		public static void spREPORTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sMODULE_NAME, string sREPORT_TYPE, string sRDL)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spREPORTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parREPORT_TYPE      = Sql.AddParameter(cmd, "@REPORT_TYPE"     , sREPORT_TYPE       ,  25);
							IDbDataParameter parRDL              = Sql.AddParameter(cmd, "@RDL"             , sRDL               );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spREPORTS_Update
		/// <summary>
		/// spREPORTS_Update
		/// </summary>
		public static void spREPORTS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sMODULE_NAME, string sREPORT_TYPE, string sRDL, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spREPORTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parREPORT_TYPE      = Sql.AddParameter(cmd, "@REPORT_TYPE"     , sREPORT_TYPE       ,  25);
				IDbDataParameter parRDL              = Sql.AddParameter(cmd, "@RDL"             , sRDL               );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdREPORTS_Update
		/// <summary>
		/// spREPORTS_Update
		/// </summary>
		public static IDbCommand cmdREPORTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spREPORTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parREPORT_TYPE      = Sql.CreateParameter(cmd, "@REPORT_TYPE"     , "string",  25);
			IDbDataParameter parRDL              = Sql.CreateParameter(cmd, "@RDL"             , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spROLES_Delete
		/// <summary>
		/// spROLES_Delete
		/// </summary>
		public static void spROLES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_Delete
		/// <summary>
		/// spROLES_Delete
		/// </summary>
		public static void spROLES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdROLES_Delete
		/// <summary>
		/// spROLES_Delete
		/// </summary>
		public static IDbCommand cmdROLES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spROLES_MassDelete
		/// <summary>
		/// spROLES_MassDelete
		/// </summary>
		public static void spROLES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_MassDelete
		/// <summary>
		/// spROLES_MassDelete
		/// </summary>
		public static void spROLES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdROLES_MassDelete
		/// <summary>
		/// spROLES_MassDelete
		/// </summary>
		public static IDbCommand cmdROLES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spROLES_MODULES_Delete
		/// <summary>
		/// spROLES_MODULES_Delete
		/// </summary>
		public static void spROLES_MODULES_Delete(Guid gROLE_ID, string sMODULE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_MODULES_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            ,  30);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_MODULES_Delete
		/// <summary>
		/// spROLES_MODULES_Delete
		/// </summary>
		public static void spROLES_MODULES_Delete(Guid gROLE_ID, string sMODULE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_MODULES_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parMODULE           = Sql.AddParameter(cmd, "@MODULE"          , sMODULE            ,  30);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdROLES_MODULES_Delete
		/// <summary>
		/// spROLES_MODULES_Delete
		/// </summary>
		public static IDbCommand cmdROLES_MODULES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_MODULES_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parMODULE           = Sql.CreateParameter(cmd, "@MODULE"          , "string",  30);
			return cmd;
		}
		#endregion

		#region spROLES_MODULES_Update
		/// <summary>
		/// spROLES_MODULES_Update
		/// </summary>
		public static void spROLES_MODULES_Update(ref Guid gID, Guid gROLE_ID, string sMODULE, bool bALLOW)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_MODULES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parMODULE           = Sql.AddAnsiParam(cmd, "@MODULE"          , sMODULE            ,  36);
							IDbDataParameter parALLOW            = Sql.AddParameter(cmd, "@ALLOW"           , bALLOW             );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_MODULES_Update
		/// <summary>
		/// spROLES_MODULES_Update
		/// </summary>
		public static void spROLES_MODULES_Update(ref Guid gID, Guid gROLE_ID, string sMODULE, bool bALLOW, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_MODULES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parMODULE           = Sql.AddAnsiParam(cmd, "@MODULE"          , sMODULE            ,  36);
				IDbDataParameter parALLOW            = Sql.AddParameter(cmd, "@ALLOW"           , bALLOW             );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdROLES_MODULES_Update
		/// <summary>
		/// spROLES_MODULES_Update
		/// </summary>
		public static IDbCommand cmdROLES_MODULES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_MODULES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parMODULE           = Sql.CreateParameter(cmd, "@MODULE"          , "ansistring",  36);
			IDbDataParameter parALLOW            = Sql.CreateParameter(cmd, "@ALLOW"           , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spROLES_Update
		/// <summary>
		/// spROLES_Update
		/// </summary>
		public static void spROLES_Update(ref Guid gID, string sNAME, string sDESCRIPTION, string sALLOW_LIST, string sDENY_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parALLOW_LIST       = Sql.AddAnsiParam(cmd, "@ALLOW_LIST"      , sALLOW_LIST        , 8000);
							IDbDataParameter parDENY_LIST        = Sql.AddAnsiParam(cmd, "@DENY_LIST"       , sDENY_LIST         , 8000);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_Update
		/// <summary>
		/// spROLES_Update
		/// </summary>
		public static void spROLES_Update(ref Guid gID, string sNAME, string sDESCRIPTION, string sALLOW_LIST, string sDENY_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parALLOW_LIST       = Sql.AddAnsiParam(cmd, "@ALLOW_LIST"      , sALLOW_LIST        , 8000);
				IDbDataParameter parDENY_LIST        = Sql.AddAnsiParam(cmd, "@DENY_LIST"       , sDENY_LIST         , 8000);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdROLES_Update
		/// <summary>
		/// spROLES_Update
		/// </summary>
		public static IDbCommand cmdROLES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parALLOW_LIST       = Sql.CreateParameter(cmd, "@ALLOW_LIST"      , "ansistring", 8000);
			IDbDataParameter parDENY_LIST        = Sql.CreateParameter(cmd, "@DENY_LIST"       , "ansistring", 8000);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spROLES_USERS_Delete
		/// <summary>
		/// spROLES_USERS_Delete
		/// </summary>
		public static void spROLES_USERS_Delete(Guid gROLE_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_USERS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_USERS_Delete
		/// <summary>
		/// spROLES_USERS_Delete
		/// </summary>
		public static void spROLES_USERS_Delete(Guid gROLE_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_USERS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdROLES_USERS_Delete
		/// <summary>
		/// spROLES_USERS_Delete
		/// </summary>
		public static IDbCommand cmdROLES_USERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_USERS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spROLES_USERS_MassUpdate
		/// <summary>
		/// spROLES_USERS_MassUpdate
		/// </summary>
		public static void spROLES_USERS_MassUpdate(Guid gROLE_ID, string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_USERS_MassUpdate";
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_USERS_MassUpdate
		/// <summary>
		/// spROLES_USERS_MassUpdate
		/// </summary>
		public static void spROLES_USERS_MassUpdate(Guid gROLE_ID, string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_USERS_MassUpdate";
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdROLES_USERS_MassUpdate
		/// <summary>
		/// spROLES_USERS_MassUpdate
		/// </summary>
		public static IDbCommand cmdROLES_USERS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_USERS_MassUpdate";
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			return cmd;
		}
		#endregion

		#region spROLES_USERS_Update
		/// <summary>
		/// spROLES_USERS_Update
		/// </summary>
		public static void spROLES_USERS_Update(ref Guid gID, Guid gROLE_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spROLES_USERS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spROLES_USERS_Update
		/// <summary>
		/// spROLES_USERS_Update
		/// </summary>
		public static void spROLES_USERS_Update(ref Guid gID, Guid gROLE_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spROLES_USERS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parROLE_ID          = Sql.AddParameter(cmd, "@ROLE_ID"         , gROLE_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdROLES_USERS_Update
		/// <summary>
		/// spROLES_USERS_Update
		/// </summary>
		public static IDbCommand cmdROLES_USERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spROLES_USERS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parROLE_ID          = Sql.CreateParameter(cmd, "@ROLE_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSAVED_SEARCH_Delete
		/// <summary>
		/// spSAVED_SEARCH_Delete
		/// </summary>
		public static void spSAVED_SEARCH_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSAVED_SEARCH_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSAVED_SEARCH_Delete
		/// <summary>
		/// spSAVED_SEARCH_Delete
		/// </summary>
		public static void spSAVED_SEARCH_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSAVED_SEARCH_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSAVED_SEARCH_Delete
		/// <summary>
		/// spSAVED_SEARCH_Delete
		/// </summary>
		public static IDbCommand cmdSAVED_SEARCH_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSAVED_SEARCH_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSAVED_SEARCH_Update
		/// <summary>
		/// spSAVED_SEARCH_Update
		/// </summary>
		public static void spSAVED_SEARCH_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSEARCH_MODULE, string sCONTENTS, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSAVED_SEARCH_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
							IDbDataParameter parSEARCH_MODULE    = Sql.AddParameter(cmd, "@SEARCH_MODULE"   , sSEARCH_MODULE     , 150);
							IDbDataParameter parCONTENTS         = Sql.AddParameter(cmd, "@CONTENTS"        , sCONTENTS          );
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSAVED_SEARCH_Update
		/// <summary>
		/// spSAVED_SEARCH_Update
		/// </summary>
		public static void spSAVED_SEARCH_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSEARCH_MODULE, string sCONTENTS, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSAVED_SEARCH_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 150);
				IDbDataParameter parSEARCH_MODULE    = Sql.AddParameter(cmd, "@SEARCH_MODULE"   , sSEARCH_MODULE     , 150);
				IDbDataParameter parCONTENTS         = Sql.AddParameter(cmd, "@CONTENTS"        , sCONTENTS          );
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdSAVED_SEARCH_Update
		/// <summary>
		/// spSAVED_SEARCH_Update
		/// </summary>
		public static IDbCommand cmdSAVED_SEARCH_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSAVED_SEARCH_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 150);
			IDbDataParameter parSEARCH_MODULE    = Sql.CreateParameter(cmd, "@SEARCH_MODULE"   , "string", 150);
			IDbDataParameter parCONTENTS         = Sql.CreateParameter(cmd, "@CONTENTS"        , "string", 104857600);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_Delete
		/// <summary>
		/// spSCHEDULERS_Delete
		/// </summary>
		public static void spSCHEDULERS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_Delete
		/// <summary>
		/// spSCHEDULERS_Delete
		/// </summary>
		public static void spSCHEDULERS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSCHEDULERS_Delete
		/// <summary>
		/// spSCHEDULERS_Delete
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_InsertOnly
		/// <summary>
		/// spSCHEDULERS_InsertOnly
		/// </summary>
		public static void spSCHEDULERS_InsertOnly(string sNAME, string sJOB, DateTime dtDATE_TIME_START, DateTime dtDATE_TIME_END, string sJOB_INTERVAL, DateTime dtTIME_FROM, DateTime dtTIME_TO, string sSTATUS, bool bCATCH_UP)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parDATE_TIME_END    = Sql.AddParameter(cmd, "@DATE_TIME_END"   , dtDATE_TIME_END    );
							IDbDataParameter parJOB_INTERVAL     = Sql.AddParameter(cmd, "@JOB_INTERVAL"    , sJOB_INTERVAL      , 100);
							IDbDataParameter parTIME_FROM        = Sql.AddParameter(cmd, "@TIME_FROM"       , dtTIME_FROM        );
							IDbDataParameter parTIME_TO          = Sql.AddParameter(cmd, "@TIME_TO"         , dtTIME_TO          );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parCATCH_UP         = Sql.AddParameter(cmd, "@CATCH_UP"        , bCATCH_UP          );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_InsertOnly
		/// <summary>
		/// spSCHEDULERS_InsertOnly
		/// </summary>
		public static void spSCHEDULERS_InsertOnly(string sNAME, string sJOB, DateTime dtDATE_TIME_START, DateTime dtDATE_TIME_END, string sJOB_INTERVAL, DateTime dtTIME_FROM, DateTime dtTIME_TO, string sSTATUS, bool bCATCH_UP, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parDATE_TIME_END    = Sql.AddParameter(cmd, "@DATE_TIME_END"   , dtDATE_TIME_END    );
				IDbDataParameter parJOB_INTERVAL     = Sql.AddParameter(cmd, "@JOB_INTERVAL"    , sJOB_INTERVAL      , 100);
				IDbDataParameter parTIME_FROM        = Sql.AddParameter(cmd, "@TIME_FROM"       , dtTIME_FROM        );
				IDbDataParameter parTIME_TO          = Sql.AddParameter(cmd, "@TIME_TO"         , dtTIME_TO          );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parCATCH_UP         = Sql.AddParameter(cmd, "@CATCH_UP"        , bCATCH_UP          );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSCHEDULERS_InsertOnly
		/// <summary>
		/// spSCHEDULERS_InsertOnly
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parJOB              = Sql.CreateParameter(cmd, "@JOB"             , "string", 255);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parDATE_TIME_END    = Sql.CreateParameter(cmd, "@DATE_TIME_END"   , "DateTime",   8);
			IDbDataParameter parJOB_INTERVAL     = Sql.CreateParameter(cmd, "@JOB_INTERVAL"    , "string", 100);
			IDbDataParameter parTIME_FROM        = Sql.CreateParameter(cmd, "@TIME_FROM"       , "DateTime",   8);
			IDbDataParameter parTIME_TO          = Sql.CreateParameter(cmd, "@TIME_TO"         , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parCATCH_UP         = Sql.CreateParameter(cmd, "@CATCH_UP"        , "bool",   1);
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_TIMES_Delete
		/// <summary>
		/// spSCHEDULERS_TIMES_Delete
		/// </summary>
		public static void spSCHEDULERS_TIMES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_TIMES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_TIMES_Delete
		/// <summary>
		/// spSCHEDULERS_TIMES_Delete
		/// </summary>
		public static void spSCHEDULERS_TIMES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_TIMES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSCHEDULERS_TIMES_Delete
		/// <summary>
		/// spSCHEDULERS_TIMES_Delete
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_TIMES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_TIMES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_TIMES_Update
		/// <summary>
		/// spSCHEDULERS_TIMES_Update
		/// </summary>
		public static void spSCHEDULERS_TIMES_Update(ref Guid gID, Guid gSCHEDULE_ID, DateTime dtEXECUTE_TIME, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_TIMES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parSCHEDULE_ID      = Sql.AddParameter(cmd, "@SCHEDULE_ID"     , gSCHEDULE_ID       );
							IDbDataParameter parEXECUTE_TIME     = Sql.AddParameter(cmd, "@EXECUTE_TIME"    , dtEXECUTE_TIME     );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_TIMES_Update
		/// <summary>
		/// spSCHEDULERS_TIMES_Update
		/// </summary>
		public static void spSCHEDULERS_TIMES_Update(ref Guid gID, Guid gSCHEDULE_ID, DateTime dtEXECUTE_TIME, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_TIMES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parSCHEDULE_ID      = Sql.AddParameter(cmd, "@SCHEDULE_ID"     , gSCHEDULE_ID       );
				IDbDataParameter parEXECUTE_TIME     = Sql.AddParameter(cmd, "@EXECUTE_TIME"    , dtEXECUTE_TIME     );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdSCHEDULERS_TIMES_Update
		/// <summary>
		/// spSCHEDULERS_TIMES_Update
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_TIMES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_TIMES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parSCHEDULE_ID      = Sql.CreateParameter(cmd, "@SCHEDULE_ID"     , "Guid",  16);
			IDbDataParameter parEXECUTE_TIME     = Sql.CreateParameter(cmd, "@EXECUTE_TIME"    , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_Update
		/// <summary>
		/// spSCHEDULERS_Update
		/// </summary>
		public static void spSCHEDULERS_Update(ref Guid gID, string sNAME, string sJOB, DateTime dtDATE_TIME_START, DateTime dtDATE_TIME_END, string sJOB_INTERVAL, DateTime dtTIME_FROM, DateTime dtTIME_TO, string sSTATUS, bool bCATCH_UP)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parDATE_TIME_END    = Sql.AddParameter(cmd, "@DATE_TIME_END"   , dtDATE_TIME_END    );
							IDbDataParameter parJOB_INTERVAL     = Sql.AddParameter(cmd, "@JOB_INTERVAL"    , sJOB_INTERVAL      , 100);
							IDbDataParameter parTIME_FROM        = Sql.AddParameter(cmd, "@TIME_FROM"       , dtTIME_FROM        );
							IDbDataParameter parTIME_TO          = Sql.AddParameter(cmd, "@TIME_TO"         , dtTIME_TO          );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parCATCH_UP         = Sql.AddParameter(cmd, "@CATCH_UP"        , bCATCH_UP          );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_Update
		/// <summary>
		/// spSCHEDULERS_Update
		/// </summary>
		public static void spSCHEDULERS_Update(ref Guid gID, string sNAME, string sJOB, DateTime dtDATE_TIME_START, DateTime dtDATE_TIME_END, string sJOB_INTERVAL, DateTime dtTIME_FROM, DateTime dtTIME_TO, string sSTATUS, bool bCATCH_UP, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parDATE_TIME_END    = Sql.AddParameter(cmd, "@DATE_TIME_END"   , dtDATE_TIME_END    );
				IDbDataParameter parJOB_INTERVAL     = Sql.AddParameter(cmd, "@JOB_INTERVAL"    , sJOB_INTERVAL      , 100);
				IDbDataParameter parTIME_FROM        = Sql.AddParameter(cmd, "@TIME_FROM"       , dtTIME_FROM        );
				IDbDataParameter parTIME_TO          = Sql.AddParameter(cmd, "@TIME_TO"         , dtTIME_TO          );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parCATCH_UP         = Sql.AddParameter(cmd, "@CATCH_UP"        , bCATCH_UP          );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdSCHEDULERS_Update
		/// <summary>
		/// spSCHEDULERS_Update
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parJOB              = Sql.CreateParameter(cmd, "@JOB"             , "string", 255);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parDATE_TIME_END    = Sql.CreateParameter(cmd, "@DATE_TIME_END"   , "DateTime",   8);
			IDbDataParameter parJOB_INTERVAL     = Sql.CreateParameter(cmd, "@JOB_INTERVAL"    , "string", 100);
			IDbDataParameter parTIME_FROM        = Sql.CreateParameter(cmd, "@TIME_FROM"       , "DateTime",   8);
			IDbDataParameter parTIME_TO          = Sql.CreateParameter(cmd, "@TIME_TO"         , "DateTime",   8);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parCATCH_UP         = Sql.CreateParameter(cmd, "@CATCH_UP"        , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_UpdateLastRun
		/// <summary>
		/// spSCHEDULERS_UpdateLastRun
		/// </summary>
		public static void spSCHEDULERS_UpdateLastRun(Guid gID, DateTime dtLAST_RUN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_UpdateLastRun";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parLAST_RUN         = Sql.AddParameter(cmd, "@LAST_RUN"        , dtLAST_RUN         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_UpdateLastRun
		/// <summary>
		/// spSCHEDULERS_UpdateLastRun
		/// </summary>
		public static void spSCHEDULERS_UpdateLastRun(Guid gID, DateTime dtLAST_RUN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_UpdateLastRun";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parLAST_RUN         = Sql.AddParameter(cmd, "@LAST_RUN"        , dtLAST_RUN         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSCHEDULERS_UpdateLastRun
		/// <summary>
		/// spSCHEDULERS_UpdateLastRun
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_UpdateLastRun(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_UpdateLastRun";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parLAST_RUN         = Sql.CreateParameter(cmd, "@LAST_RUN"        , "DateTime",   8);
			return cmd;
		}
		#endregion

		#region spSCHEDULERS_UpdateStatus
		/// <summary>
		/// spSCHEDULERS_UpdateStatus
		/// </summary>
		public static void spSCHEDULERS_UpdateStatus(string sJOB, string sSTATUS)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSCHEDULERS_UpdateStatus";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSCHEDULERS_UpdateStatus
		/// <summary>
		/// spSCHEDULERS_UpdateStatus
		/// </summary>
		public static void spSCHEDULERS_UpdateStatus(string sJOB, string sSTATUS, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSCHEDULERS_UpdateStatus";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parJOB              = Sql.AddParameter(cmd, "@JOB"             , sJOB               , 255);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSCHEDULERS_UpdateStatus
		/// <summary>
		/// spSCHEDULERS_UpdateStatus
		/// </summary>
		public static IDbCommand cmdSCHEDULERS_UpdateStatus(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSCHEDULERS_UpdateStatus";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parJOB              = Sql.CreateParameter(cmd, "@JOB"             , "string", 255);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			return cmd;
		}
		#endregion

		#region spSHIPPERS_Delete
		/// <summary>
		/// spSHIPPERS_Delete
		/// </summary>
		public static void spSHIPPERS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHIPPERS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHIPPERS_Delete
		/// <summary>
		/// spSHIPPERS_Delete
		/// </summary>
		public static void spSHIPPERS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHIPPERS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSHIPPERS_Delete
		/// <summary>
		/// spSHIPPERS_Delete
		/// </summary>
		public static IDbCommand cmdSHIPPERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHIPPERS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSHIPPERS_Update
		/// <summary>
		/// spSHIPPERS_Update
		/// </summary>
		public static void spSHIPPERS_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHIPPERS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHIPPERS_Update
		/// <summary>
		/// spSHIPPERS_Update
		/// </summary>
		public static void spSHIPPERS_Update(ref Guid gID, string sNAME, string sSTATUS, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHIPPERS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdSHIPPERS_Update
		/// <summary>
		/// spSHIPPERS_Update
		/// </summary>
		public static IDbCommand cmdSHIPPERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHIPPERS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSHORTCUTS_Delete
		/// <summary>
		/// spSHORTCUTS_Delete
		/// </summary>
		public static void spSHORTCUTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHORTCUTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHORTCUTS_Delete
		/// <summary>
		/// spSHORTCUTS_Delete
		/// </summary>
		public static void spSHORTCUTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHORTCUTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSHORTCUTS_Delete
		/// <summary>
		/// spSHORTCUTS_Delete
		/// </summary>
		public static IDbCommand cmdSHORTCUTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHORTCUTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSHORTCUTS_InsertOnly
		/// <summary>
		/// spSHORTCUTS_InsertOnly
		/// </summary>
		public static void spSHORTCUTS_InsertOnly(string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, string sIMAGE_NAME, bool bSHORTCUT_ENABLED, Int32 nSHORTCUT_ORDER, string sSHORTCUT_MODULE, string sSHORTCUT_ACLTYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHORTCUTS_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 150);
							IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     , 255);
							IDbDataParameter parIMAGE_NAME       = Sql.AddParameter(cmd, "@IMAGE_NAME"      , sIMAGE_NAME        ,  50);
							IDbDataParameter parSHORTCUT_ENABLED = Sql.AddParameter(cmd, "@SHORTCUT_ENABLED", bSHORTCUT_ENABLED  );
							IDbDataParameter parSHORTCUT_ORDER   = Sql.AddParameter(cmd, "@SHORTCUT_ORDER"  , nSHORTCUT_ORDER    );
							IDbDataParameter parSHORTCUT_MODULE  = Sql.AddParameter(cmd, "@SHORTCUT_MODULE" , sSHORTCUT_MODULE   ,  25);
							IDbDataParameter parSHORTCUT_ACLTYPE = Sql.AddParameter(cmd, "@SHORTCUT_ACLTYPE", sSHORTCUT_ACLTYPE  , 100);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHORTCUTS_InsertOnly
		/// <summary>
		/// spSHORTCUTS_InsertOnly
		/// </summary>
		public static void spSHORTCUTS_InsertOnly(string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, string sIMAGE_NAME, bool bSHORTCUT_ENABLED, Int32 nSHORTCUT_ORDER, string sSHORTCUT_MODULE, string sSHORTCUT_ACLTYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHORTCUTS_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 150);
				IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     , 255);
				IDbDataParameter parIMAGE_NAME       = Sql.AddParameter(cmd, "@IMAGE_NAME"      , sIMAGE_NAME        ,  50);
				IDbDataParameter parSHORTCUT_ENABLED = Sql.AddParameter(cmd, "@SHORTCUT_ENABLED", bSHORTCUT_ENABLED  );
				IDbDataParameter parSHORTCUT_ORDER   = Sql.AddParameter(cmd, "@SHORTCUT_ORDER"  , nSHORTCUT_ORDER    );
				IDbDataParameter parSHORTCUT_MODULE  = Sql.AddParameter(cmd, "@SHORTCUT_MODULE" , sSHORTCUT_MODULE   ,  25);
				IDbDataParameter parSHORTCUT_ACLTYPE = Sql.AddParameter(cmd, "@SHORTCUT_ACLTYPE", sSHORTCUT_ACLTYPE  , 100);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSHORTCUTS_InsertOnly
		/// <summary>
		/// spSHORTCUTS_InsertOnly
		/// </summary>
		public static IDbCommand cmdSHORTCUTS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHORTCUTS_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string", 150);
			IDbDataParameter parRELATIVE_PATH    = Sql.CreateParameter(cmd, "@RELATIVE_PATH"   , "string", 255);
			IDbDataParameter parIMAGE_NAME       = Sql.CreateParameter(cmd, "@IMAGE_NAME"      , "string",  50);
			IDbDataParameter parSHORTCUT_ENABLED = Sql.CreateParameter(cmd, "@SHORTCUT_ENABLED", "bool",   1);
			IDbDataParameter parSHORTCUT_ORDER   = Sql.CreateParameter(cmd, "@SHORTCUT_ORDER"  , "Int32",   4);
			IDbDataParameter parSHORTCUT_MODULE  = Sql.CreateParameter(cmd, "@SHORTCUT_MODULE" , "string",  25);
			IDbDataParameter parSHORTCUT_ACLTYPE = Sql.CreateParameter(cmd, "@SHORTCUT_ACLTYPE", "string", 100);
			return cmd;
		}
		#endregion

		#region spSHORTCUTS_ORDER_MoveDown
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveDown
		/// </summary>
		public static void spSHORTCUTS_ORDER_MoveDown(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHORTCUTS_ORDER_MoveDown";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHORTCUTS_ORDER_MoveDown
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveDown
		/// </summary>
		public static void spSHORTCUTS_ORDER_MoveDown(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHORTCUTS_ORDER_MoveDown";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSHORTCUTS_ORDER_MoveDown
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveDown
		/// </summary>
		public static IDbCommand cmdSHORTCUTS_ORDER_MoveDown(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHORTCUTS_ORDER_MoveDown";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSHORTCUTS_ORDER_MoveUp
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveUp
		/// </summary>
		public static void spSHORTCUTS_ORDER_MoveUp(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHORTCUTS_ORDER_MoveUp";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHORTCUTS_ORDER_MoveUp
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveUp
		/// </summary>
		public static void spSHORTCUTS_ORDER_MoveUp(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHORTCUTS_ORDER_MoveUp";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSHORTCUTS_ORDER_MoveUp
		/// <summary>
		/// spSHORTCUTS_ORDER_MoveUp
		/// </summary>
		public static IDbCommand cmdSHORTCUTS_ORDER_MoveUp(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHORTCUTS_ORDER_MoveUp";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spSHORTCUTS_Update
		/// <summary>
		/// spSHORTCUTS_Update
		/// </summary>
		public static void spSHORTCUTS_Update(ref Guid gID, string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, string sIMAGE_NAME, bool bSHORTCUT_ENABLED, Int32 nSHORTCUT_ORDER, string sSHORTCUT_MODULE, string sSHORTCUT_ACLTYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSHORTCUTS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 150);
							IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     , 255);
							IDbDataParameter parIMAGE_NAME       = Sql.AddParameter(cmd, "@IMAGE_NAME"      , sIMAGE_NAME        ,  50);
							IDbDataParameter parSHORTCUT_ENABLED = Sql.AddParameter(cmd, "@SHORTCUT_ENABLED", bSHORTCUT_ENABLED  );
							IDbDataParameter parSHORTCUT_ORDER   = Sql.AddParameter(cmd, "@SHORTCUT_ORDER"  , nSHORTCUT_ORDER    );
							IDbDataParameter parSHORTCUT_MODULE  = Sql.AddParameter(cmd, "@SHORTCUT_MODULE" , sSHORTCUT_MODULE   ,  25);
							IDbDataParameter parSHORTCUT_ACLTYPE = Sql.AddParameter(cmd, "@SHORTCUT_ACLTYPE", sSHORTCUT_ACLTYPE  , 100);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSHORTCUTS_Update
		/// <summary>
		/// spSHORTCUTS_Update
		/// </summary>
		public static void spSHORTCUTS_Update(ref Guid gID, string sMODULE_NAME, string sDISPLAY_NAME, string sRELATIVE_PATH, string sIMAGE_NAME, bool bSHORTCUT_ENABLED, Int32 nSHORTCUT_ORDER, string sSHORTCUT_MODULE, string sSHORTCUT_ACLTYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSHORTCUTS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 150);
				IDbDataParameter parRELATIVE_PATH    = Sql.AddParameter(cmd, "@RELATIVE_PATH"   , sRELATIVE_PATH     , 255);
				IDbDataParameter parIMAGE_NAME       = Sql.AddParameter(cmd, "@IMAGE_NAME"      , sIMAGE_NAME        ,  50);
				IDbDataParameter parSHORTCUT_ENABLED = Sql.AddParameter(cmd, "@SHORTCUT_ENABLED", bSHORTCUT_ENABLED  );
				IDbDataParameter parSHORTCUT_ORDER   = Sql.AddParameter(cmd, "@SHORTCUT_ORDER"  , nSHORTCUT_ORDER    );
				IDbDataParameter parSHORTCUT_MODULE  = Sql.AddParameter(cmd, "@SHORTCUT_MODULE" , sSHORTCUT_MODULE   ,  25);
				IDbDataParameter parSHORTCUT_ACLTYPE = Sql.AddParameter(cmd, "@SHORTCUT_ACLTYPE", sSHORTCUT_ACLTYPE  , 100);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdSHORTCUTS_Update
		/// <summary>
		/// spSHORTCUTS_Update
		/// </summary>
		public static IDbCommand cmdSHORTCUTS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSHORTCUTS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string", 150);
			IDbDataParameter parRELATIVE_PATH    = Sql.CreateParameter(cmd, "@RELATIVE_PATH"   , "string", 255);
			IDbDataParameter parIMAGE_NAME       = Sql.CreateParameter(cmd, "@IMAGE_NAME"      , "string",  50);
			IDbDataParameter parSHORTCUT_ENABLED = Sql.CreateParameter(cmd, "@SHORTCUT_ENABLED", "bool",   1);
			IDbDataParameter parSHORTCUT_ORDER   = Sql.CreateParameter(cmd, "@SHORTCUT_ORDER"  , "Int32",   4);
			IDbDataParameter parSHORTCUT_MODULE  = Sql.CreateParameter(cmd, "@SHORTCUT_MODULE" , "string",  25);
			IDbDataParameter parSHORTCUT_ACLTYPE = Sql.CreateParameter(cmd, "@SHORTCUT_ACLTYPE", "string", 100);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSqlBackupDatabase
		/// <summary>
		/// spSqlBackupDatabase
		/// </summary>
		public static void spSqlBackupDatabase(ref string sFILENAME, string sTYPE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBackupDatabase";
							IDbDataParameter parFILENAME = Sql.AddParameter(cmd, "@FILENAME", sFILENAME  , 255);
							IDbDataParameter parTYPE     = Sql.AddParameter(cmd, "@TYPE"    , sTYPE      ,  20);
							parFILENAME.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							sFILENAME = Sql.ToString(parFILENAME.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBackupDatabase
		/// <summary>
		/// spSqlBackupDatabase
		/// </summary>
		public static void spSqlBackupDatabase(ref string sFILENAME, string sTYPE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBackupDatabase";
				IDbDataParameter parFILENAME = Sql.AddParameter(cmd, "@FILENAME", sFILENAME  , 255);
				IDbDataParameter parTYPE     = Sql.AddParameter(cmd, "@TYPE"    , sTYPE      ,  20);
				parFILENAME.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				sFILENAME = Sql.ToString(parFILENAME.Value);
			}
		}
		#endregion

		#region cmdSqlBackupDatabase
		/// <summary>
		/// spSqlBackupDatabase
		/// </summary>
		public static IDbCommand cmdSqlBackupDatabase(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBackupDatabase";
			IDbDataParameter parFILENAME = Sql.CreateParameter(cmd, "@FILENAME", "string", 255);
			IDbDataParameter parTYPE     = Sql.CreateParameter(cmd, "@TYPE"    , "string",  20);
			parFILENAME.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spSqlBuildAllAuditTables
		/// <summary>
		/// spSqlBuildAllAuditTables
		/// </summary>
		public static void spSqlBuildAllAuditTables()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBuildAllAuditTables";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildAllAuditTables
		/// <summary>
		/// spSqlBuildAllAuditTables
		/// </summary>
		public static void spSqlBuildAllAuditTables(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBuildAllAuditTables";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildAllAuditTables
		/// <summary>
		/// spSqlBuildAllAuditTables
		/// </summary>
		public static IDbCommand cmdSqlBuildAllAuditTables(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBuildAllAuditTables";
			return cmd;
		}
		#endregion

		#region spSqlBuildAllAuditTriggers
		/// <summary>
		/// spSqlBuildAllAuditTriggers
		/// </summary>
		public static void spSqlBuildAllAuditTriggers()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBuildAllAuditTriggers";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildAllAuditTriggers
		/// <summary>
		/// spSqlBuildAllAuditTriggers
		/// </summary>
		public static void spSqlBuildAllAuditTriggers(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBuildAllAuditTriggers";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildAllAuditTriggers
		/// <summary>
		/// spSqlBuildAllAuditTriggers
		/// </summary>
		public static IDbCommand cmdSqlBuildAllAuditTriggers(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBuildAllAuditTriggers";
			return cmd;
		}
		#endregion

		#region spSqlBuildAuditTable
		/// <summary>
		/// spSqlBuildAuditTable
		/// </summary>
		public static void spSqlBuildAuditTable(string sTABLE_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBuildAuditTable";
							IDbDataParameter parTABLE_NAME = Sql.AddAnsiParam(cmd, "@TABLE_NAME", sTABLE_NAME  ,  80);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildAuditTable
		/// <summary>
		/// spSqlBuildAuditTable
		/// </summary>
		public static void spSqlBuildAuditTable(string sTABLE_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBuildAuditTable";
				IDbDataParameter parTABLE_NAME = Sql.AddAnsiParam(cmd, "@TABLE_NAME", sTABLE_NAME  ,  80);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildAuditTable
		/// <summary>
		/// spSqlBuildAuditTable
		/// </summary>
		public static IDbCommand cmdSqlBuildAuditTable(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBuildAuditTable";
			IDbDataParameter parTABLE_NAME = Sql.CreateParameter(cmd, "@TABLE_NAME", "ansistring",  80);
			return cmd;
		}
		#endregion

		#region spSqlBuildAuditTrigger
		/// <summary>
		/// spSqlBuildAuditTrigger
		/// </summary>
		public static void spSqlBuildAuditTrigger(string sTABLE_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBuildAuditTrigger";
							IDbDataParameter parTABLE_NAME = Sql.AddAnsiParam(cmd, "@TABLE_NAME", sTABLE_NAME  ,  80);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildAuditTrigger
		/// <summary>
		/// spSqlBuildAuditTrigger
		/// </summary>
		public static void spSqlBuildAuditTrigger(string sTABLE_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBuildAuditTrigger";
				IDbDataParameter parTABLE_NAME = Sql.AddAnsiParam(cmd, "@TABLE_NAME", sTABLE_NAME  ,  80);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildAuditTrigger
		/// <summary>
		/// spSqlBuildAuditTrigger
		/// </summary>
		public static IDbCommand cmdSqlBuildAuditTrigger(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBuildAuditTrigger";
			IDbDataParameter parTABLE_NAME = Sql.CreateParameter(cmd, "@TABLE_NAME", "ansistring",  80);
			return cmd;
		}
		#endregion

		#region spSqlBuildProcedures
		/// <summary>
		/// spSqlBuildProcedures
		/// </summary>
		public static void spSqlBuildProcedures(string sTableName)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlBuildProcedures";
							IDbDataParameter parTableName = Sql.AddAnsiParam(cmd, "@TableName", sTableName  ,  80);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildProcedures
		/// <summary>
		/// spSqlBuildProcedures
		/// </summary>
		public static void spSqlBuildProcedures(string sTableName, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlBuildProcedures";
				IDbDataParameter parTableName = Sql.AddAnsiParam(cmd, "@TableName", sTableName  ,  80);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildProcedures
		/// <summary>
		/// spSqlBuildProcedures
		/// </summary>
		public static IDbCommand cmdSqlBuildProcedures(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlBuildProcedures";
			IDbDataParameter parTableName = Sql.CreateParameter(cmd, "@TableName", "ansistring",  80);
			return cmd;
		}
		#endregion

		#region spSqlBuildRelationshipProcedures
		/// <summary>
		/// spSqlBuildRelationshipProcedures
		/// </summary>
		public static void spSqlBuildRelationshipProcedures(string sTableName)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spSqlBuildRelationshipProcedur";
							else
								cmd.CommandText = "spSqlBuildRelationshipProcedures";
							IDbDataParameter parTableName = Sql.AddAnsiParam(cmd, "@TableName", sTableName  ,  80);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlBuildRelationshipProcedures
		/// <summary>
		/// spSqlBuildRelationshipProcedures
		/// </summary>
		public static void spSqlBuildRelationshipProcedures(string sTableName, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spSqlBuildRelationshipProcedur";
				else
					cmd.CommandText = "spSqlBuildRelationshipProcedures";
				IDbDataParameter parTableName = Sql.AddAnsiParam(cmd, "@TableName", sTableName  ,  80);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlBuildRelationshipProcedures
		/// <summary>
		/// spSqlBuildRelationshipProcedures
		/// </summary>
		public static IDbCommand cmdSqlBuildRelationshipProcedures(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spSqlBuildRelationshipProcedur";
			else
				cmd.CommandText = "spSqlBuildRelationshipProcedures";
			IDbDataParameter parTableName = Sql.CreateParameter(cmd, "@TableName", "ansistring",  80);
			return cmd;
		}
		#endregion

		#region spSqlDropAllAuditTables
		/// <summary>
		/// spSqlDropAllAuditTables
		/// </summary>
		public static void spSqlDropAllAuditTables()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlDropAllAuditTables";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlDropAllAuditTables
		/// <summary>
		/// spSqlDropAllAuditTables
		/// </summary>
		public static void spSqlDropAllAuditTables(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlDropAllAuditTables";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlDropAllAuditTables
		/// <summary>
		/// spSqlDropAllAuditTables
		/// </summary>
		public static IDbCommand cmdSqlDropAllAuditTables(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlDropAllAuditTables";
			return cmd;
		}
		#endregion

		#region spSqlDropAllAuditTriggers
		/// <summary>
		/// spSqlDropAllAuditTriggers
		/// </summary>
		public static void spSqlDropAllAuditTriggers()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlDropAllAuditTriggers";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlDropAllAuditTriggers
		/// <summary>
		/// spSqlDropAllAuditTriggers
		/// </summary>
		public static void spSqlDropAllAuditTriggers(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlDropAllAuditTriggers";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlDropAllAuditTriggers
		/// <summary>
		/// spSqlDropAllAuditTriggers
		/// </summary>
		public static IDbCommand cmdSqlDropAllAuditTriggers(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlDropAllAuditTriggers";
			return cmd;
		}
		#endregion

		#region spSqlPruneDatabase
		/// <summary>
		/// spSqlPruneDatabase
		/// </summary>
		public static void spSqlPruneDatabase()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlPruneDatabase";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlPruneDatabase
		/// <summary>
		/// spSqlPruneDatabase
		/// </summary>
		public static void spSqlPruneDatabase(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlPruneDatabase";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlPruneDatabase
		/// <summary>
		/// spSqlPruneDatabase
		/// </summary>
		public static IDbCommand cmdSqlPruneDatabase(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlPruneDatabase";
			return cmd;
		}
		#endregion

		#region spSqlRefreshAllViews
		/// <summary>
		/// spSqlRefreshAllViews
		/// </summary>
		public static void spSqlRefreshAllViews()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlRefreshAllViews";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlRefreshAllViews
		/// <summary>
		/// spSqlRefreshAllViews
		/// </summary>
		public static void spSqlRefreshAllViews(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlRefreshAllViews";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlRefreshAllViews
		/// <summary>
		/// spSqlRefreshAllViews
		/// </summary>
		public static IDbCommand cmdSqlRefreshAllViews(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlRefreshAllViews";
			return cmd;
		}
		#endregion

		#region spSqlTableAddColumn
		/// <summary>
		/// spSqlTableAddColumn
		/// </summary>
		public static void spSqlTableAddColumn(string sTABLE_NAME, string sCOLUMN_NAME, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, string sDEFAULT_VALUE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlTableAddColumn";
							IDbDataParameter parTABLE_NAME    = Sql.AddAnsiParam(cmd, "@TABLE_NAME"   , sTABLE_NAME     , 255);
							IDbDataParameter parCOLUMN_NAME   = Sql.AddAnsiParam(cmd, "@COLUMN_NAME"  , sCOLUMN_NAME    , 255);
							IDbDataParameter parDATA_TYPE     = Sql.AddAnsiParam(cmd, "@DATA_TYPE"    , sDATA_TYPE      , 255);
							IDbDataParameter parMAX_SIZE      = Sql.AddParameter(cmd, "@MAX_SIZE"     , nMAX_SIZE       );
							IDbDataParameter parREQUIRED      = Sql.AddParameter(cmd, "@REQUIRED"     , bREQUIRED       );
							IDbDataParameter parDEFAULT_VALUE = Sql.AddAnsiParam(cmd, "@DEFAULT_VALUE", sDEFAULT_VALUE  , 255);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlTableAddColumn
		/// <summary>
		/// spSqlTableAddColumn
		/// </summary>
		public static void spSqlTableAddColumn(string sTABLE_NAME, string sCOLUMN_NAME, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, string sDEFAULT_VALUE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlTableAddColumn";
				IDbDataParameter parTABLE_NAME    = Sql.AddAnsiParam(cmd, "@TABLE_NAME"   , sTABLE_NAME     , 255);
				IDbDataParameter parCOLUMN_NAME   = Sql.AddAnsiParam(cmd, "@COLUMN_NAME"  , sCOLUMN_NAME    , 255);
				IDbDataParameter parDATA_TYPE     = Sql.AddAnsiParam(cmd, "@DATA_TYPE"    , sDATA_TYPE      , 255);
				IDbDataParameter parMAX_SIZE      = Sql.AddParameter(cmd, "@MAX_SIZE"     , nMAX_SIZE       );
				IDbDataParameter parREQUIRED      = Sql.AddParameter(cmd, "@REQUIRED"     , bREQUIRED       );
				IDbDataParameter parDEFAULT_VALUE = Sql.AddAnsiParam(cmd, "@DEFAULT_VALUE", sDEFAULT_VALUE  , 255);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlTableAddColumn
		/// <summary>
		/// spSqlTableAddColumn
		/// </summary>
		public static IDbCommand cmdSqlTableAddColumn(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlTableAddColumn";
			IDbDataParameter parTABLE_NAME    = Sql.CreateParameter(cmd, "@TABLE_NAME"   , "ansistring", 255);
			IDbDataParameter parCOLUMN_NAME   = Sql.CreateParameter(cmd, "@COLUMN_NAME"  , "ansistring", 255);
			IDbDataParameter parDATA_TYPE     = Sql.CreateParameter(cmd, "@DATA_TYPE"    , "ansistring", 255);
			IDbDataParameter parMAX_SIZE      = Sql.CreateParameter(cmd, "@MAX_SIZE"     , "Int32",   4);
			IDbDataParameter parREQUIRED      = Sql.CreateParameter(cmd, "@REQUIRED"     , "bool",   1);
			IDbDataParameter parDEFAULT_VALUE = Sql.CreateParameter(cmd, "@DEFAULT_VALUE", "ansistring", 255);
			return cmd;
		}
		#endregion

		#region spSqlTableAlterColumn
		/// <summary>
		/// spSqlTableAlterColumn
		/// </summary>
		public static void spSqlTableAlterColumn(string sTABLE_NAME, string sCOLUMN_NAME, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, string sDEFAULT_VALUE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlTableAlterColumn";
							IDbDataParameter parTABLE_NAME    = Sql.AddAnsiParam(cmd, "@TABLE_NAME"   , sTABLE_NAME     , 255);
							IDbDataParameter parCOLUMN_NAME   = Sql.AddAnsiParam(cmd, "@COLUMN_NAME"  , sCOLUMN_NAME    , 255);
							IDbDataParameter parDATA_TYPE     = Sql.AddAnsiParam(cmd, "@DATA_TYPE"    , sDATA_TYPE      , 255);
							IDbDataParameter parMAX_SIZE      = Sql.AddParameter(cmd, "@MAX_SIZE"     , nMAX_SIZE       );
							IDbDataParameter parREQUIRED      = Sql.AddParameter(cmd, "@REQUIRED"     , bREQUIRED       );
							IDbDataParameter parDEFAULT_VALUE = Sql.AddAnsiParam(cmd, "@DEFAULT_VALUE", sDEFAULT_VALUE  , 255);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlTableAlterColumn
		/// <summary>
		/// spSqlTableAlterColumn
		/// </summary>
		public static void spSqlTableAlterColumn(string sTABLE_NAME, string sCOLUMN_NAME, string sDATA_TYPE, Int32 nMAX_SIZE, bool bREQUIRED, string sDEFAULT_VALUE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlTableAlterColumn";
				IDbDataParameter parTABLE_NAME    = Sql.AddAnsiParam(cmd, "@TABLE_NAME"   , sTABLE_NAME     , 255);
				IDbDataParameter parCOLUMN_NAME   = Sql.AddAnsiParam(cmd, "@COLUMN_NAME"  , sCOLUMN_NAME    , 255);
				IDbDataParameter parDATA_TYPE     = Sql.AddAnsiParam(cmd, "@DATA_TYPE"    , sDATA_TYPE      , 255);
				IDbDataParameter parMAX_SIZE      = Sql.AddParameter(cmd, "@MAX_SIZE"     , nMAX_SIZE       );
				IDbDataParameter parREQUIRED      = Sql.AddParameter(cmd, "@REQUIRED"     , bREQUIRED       );
				IDbDataParameter parDEFAULT_VALUE = Sql.AddAnsiParam(cmd, "@DEFAULT_VALUE", sDEFAULT_VALUE  , 255);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlTableAlterColumn
		/// <summary>
		/// spSqlTableAlterColumn
		/// </summary>
		public static IDbCommand cmdSqlTableAlterColumn(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlTableAlterColumn";
			IDbDataParameter parTABLE_NAME    = Sql.CreateParameter(cmd, "@TABLE_NAME"   , "ansistring", 255);
			IDbDataParameter parCOLUMN_NAME   = Sql.CreateParameter(cmd, "@COLUMN_NAME"  , "ansistring", 255);
			IDbDataParameter parDATA_TYPE     = Sql.CreateParameter(cmd, "@DATA_TYPE"    , "ansistring", 255);
			IDbDataParameter parMAX_SIZE      = Sql.CreateParameter(cmd, "@MAX_SIZE"     , "Int32",   4);
			IDbDataParameter parREQUIRED      = Sql.CreateParameter(cmd, "@REQUIRED"     , "bool",   1);
			IDbDataParameter parDEFAULT_VALUE = Sql.CreateParameter(cmd, "@DEFAULT_VALUE", "ansistring", 255);
			return cmd;
		}
		#endregion

		#region spSqlTableDropColumn
		/// <summary>
		/// spSqlTableDropColumn
		/// </summary>
		public static void spSqlTableDropColumn(string sTABLE_NAME, string sCOLUMN_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlTableDropColumn";
							IDbDataParameter parTABLE_NAME  = Sql.AddAnsiParam(cmd, "@TABLE_NAME" , sTABLE_NAME   , 255);
							IDbDataParameter parCOLUMN_NAME = Sql.AddAnsiParam(cmd, "@COLUMN_NAME", sCOLUMN_NAME  , 255);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlTableDropColumn
		/// <summary>
		/// spSqlTableDropColumn
		/// </summary>
		public static void spSqlTableDropColumn(string sTABLE_NAME, string sCOLUMN_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlTableDropColumn";
				IDbDataParameter parTABLE_NAME  = Sql.AddAnsiParam(cmd, "@TABLE_NAME" , sTABLE_NAME   , 255);
				IDbDataParameter parCOLUMN_NAME = Sql.AddAnsiParam(cmd, "@COLUMN_NAME", sCOLUMN_NAME  , 255);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlTableDropColumn
		/// <summary>
		/// spSqlTableDropColumn
		/// </summary>
		public static IDbCommand cmdSqlTableDropColumn(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlTableDropColumn";
			IDbDataParameter parTABLE_NAME  = Sql.CreateParameter(cmd, "@TABLE_NAME" , "ansistring", 255);
			IDbDataParameter parCOLUMN_NAME = Sql.CreateParameter(cmd, "@COLUMN_NAME", "ansistring", 255);
			return cmd;
		}
		#endregion

		#region spSqlTableDropColumnConstraint
		/// <summary>
		/// spSqlTableDropColumnConstraint
		/// </summary>
		public static void spSqlTableDropColumnConstraint(string sTABLE_NAME, string sCOLUMN_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spSqlTableDropColumnConstraint";
							IDbDataParameter parTABLE_NAME  = Sql.AddAnsiParam(cmd, "@TABLE_NAME" , sTABLE_NAME   , 255);
							IDbDataParameter parCOLUMN_NAME = Sql.AddAnsiParam(cmd, "@COLUMN_NAME", sCOLUMN_NAME  , 255);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spSqlTableDropColumnConstraint
		/// <summary>
		/// spSqlTableDropColumnConstraint
		/// </summary>
		public static void spSqlTableDropColumnConstraint(string sTABLE_NAME, string sCOLUMN_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spSqlTableDropColumnConstraint";
				IDbDataParameter parTABLE_NAME  = Sql.AddAnsiParam(cmd, "@TABLE_NAME" , sTABLE_NAME   , 255);
				IDbDataParameter parCOLUMN_NAME = Sql.AddAnsiParam(cmd, "@COLUMN_NAME", sCOLUMN_NAME  , 255);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdSqlTableDropColumnConstraint
		/// <summary>
		/// spSqlTableDropColumnConstraint
		/// </summary>
		public static IDbCommand cmdSqlTableDropColumnConstraint(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spSqlTableDropColumnConstraint";
			IDbDataParameter parTABLE_NAME  = Sql.CreateParameter(cmd, "@TABLE_NAME" , "ansistring", 255);
			IDbDataParameter parCOLUMN_NAME = Sql.CreateParameter(cmd, "@COLUMN_NAME", "ansistring", 255);
			return cmd;
		}
		#endregion

		#region spTASKS_Delete
		/// <summary>
		/// spTASKS_Delete
		/// </summary>
		public static void spTASKS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTASKS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTASKS_Delete
		/// <summary>
		/// spTASKS_Delete
		/// </summary>
		public static void spTASKS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTASKS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTASKS_Delete
		/// <summary>
		/// spTASKS_Delete
		/// </summary>
		public static IDbCommand cmdTASKS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTASKS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTASKS_MassDelete
		/// <summary>
		/// spTASKS_MassDelete
		/// </summary>
		public static void spTASKS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTASKS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTASKS_MassDelete
		/// <summary>
		/// spTASKS_MassDelete
		/// </summary>
		public static void spTASKS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTASKS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTASKS_MassDelete
		/// <summary>
		/// spTASKS_MassDelete
		/// </summary>
		public static IDbCommand cmdTASKS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTASKS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTASKS_MassUpdate
		/// <summary>
		/// spTASKS_MassUpdate
		/// </summary>
		public static void spTASKS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPRIORITY, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTASKS_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTASKS_MassUpdate
		/// <summary>
		/// spTASKS_MassUpdate
		/// </summary>
		public static void spTASKS_MassUpdate(string sID_LIST, Guid gASSIGNED_USER_ID, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPRIORITY, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTASKS_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTASKS_MassUpdate
		/// <summary>
		/// spTASKS_MassUpdate
		/// </summary>
		public static IDbCommand cmdTASKS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTASKS_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDATE_TIME_DUE    = Sql.CreateParameter(cmd, "@DATE_TIME_DUE"   , "DateTime",   8);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTASKS_Update
		/// <summary>
		/// spTASKS_Update
		/// </summary>
		public static void spTASKS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, string sPRIORITY, string sDESCRIPTION, Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTASKS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
							IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
							IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
							IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTASKS_Update
		/// <summary>
		/// spTASKS_Update
		/// </summary>
		public static void spTASKS_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sNAME, string sSTATUS, DateTime dtDATE_TIME_DUE, DateTime dtDATE_TIME_START, string sPARENT_TYPE, Guid gPARENT_ID, Guid gCONTACT_ID, string sPRIORITY, string sDESCRIPTION, Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTASKS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDATE_TIME_DUE    = Sql.AddParameter(cmd, "@DATE_TIME_DUE"   , dtDATE_TIME_DUE    );
				IDbDataParameter parDATE_TIME_START  = Sql.AddParameter(cmd, "@DATE_TIME_START" , dtDATE_TIME_START  );
				IDbDataParameter parPARENT_TYPE      = Sql.AddParameter(cmd, "@PARENT_TYPE"     , sPARENT_TYPE       ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parCONTACT_ID       = Sql.AddParameter(cmd, "@CONTACT_ID"      , gCONTACT_ID        );
				IDbDataParameter parPRIORITY         = Sql.AddParameter(cmd, "@PRIORITY"        , sPRIORITY          ,  25);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTASKS_Update
		/// <summary>
		/// spTASKS_Update
		/// </summary>
		public static IDbCommand cmdTASKS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTASKS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDATE_TIME_DUE    = Sql.CreateParameter(cmd, "@DATE_TIME_DUE"   , "DateTime",   8);
			IDbDataParameter parDATE_TIME_START  = Sql.CreateParameter(cmd, "@DATE_TIME_START" , "DateTime",   8);
			IDbDataParameter parPARENT_TYPE      = Sql.CreateParameter(cmd, "@PARENT_TYPE"     , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parCONTACT_ID       = Sql.CreateParameter(cmd, "@CONTACT_ID"      , "Guid",  16);
			IDbDataParameter parPRIORITY         = Sql.CreateParameter(cmd, "@PRIORITY"        , "string",  25);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTAX_RATES_Delete
		/// <summary>
		/// spTAX_RATES_Delete
		/// </summary>
		public static void spTAX_RATES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTAX_RATES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTAX_RATES_Delete
		/// <summary>
		/// spTAX_RATES_Delete
		/// </summary>
		public static void spTAX_RATES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTAX_RATES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTAX_RATES_Delete
		/// <summary>
		/// spTAX_RATES_Delete
		/// </summary>
		public static IDbCommand cmdTAX_RATES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTAX_RATES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTAX_RATES_Update
		/// <summary>
		/// spTAX_RATES_Update
		/// </summary>
		public static void spTAX_RATES_Update(ref Guid gID, string sNAME, string sSTATUS, decimal dVALUE, Int32 nLIST_ORDER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTAX_RATES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , dVALUE             );
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTAX_RATES_Update
		/// <summary>
		/// spTAX_RATES_Update
		/// </summary>
		public static void spTAX_RATES_Update(ref Guid gID, string sNAME, string sSTATUS, decimal dVALUE, Int32 nLIST_ORDER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTAX_RATES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parVALUE            = Sql.AddParameter(cmd, "@VALUE"           , dVALUE             );
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTAX_RATES_Update
		/// <summary>
		/// spTAX_RATES_Update
		/// </summary>
		public static IDbCommand cmdTAX_RATES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTAX_RATES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parVALUE            = Sql.CreateParameter(cmd, "@VALUE"           , "decimal",   8);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_Delete
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Delete
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_Delete(Guid gTEAM_ID, Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_Delete
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Delete
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_Delete(Guid gTEAM_ID, Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_Delete
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Delete
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_DeleteUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_DeleteUser
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_DeleteUser(Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_DeleteUser";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_DeleteUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_DeleteUser
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_DeleteUser(Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_DeleteUser";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_DeleteUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_DeleteUser
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_DeleteUser(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_DeleteUser";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spTEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_MassUpdate(Guid gTEAM_ID, string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_MassUpdate";
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spTEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_MassUpdate(Guid gTEAM_ID, string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_MassUpdate";
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spTEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_MassUpdate";
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_RefreshAll
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshAll
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_RefreshAll()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshAll";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_RefreshAll
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshAll
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_RefreshAll(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshAll";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_RefreshAll
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshAll
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_RefreshAll(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshAll";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_RefreshUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshUser
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_RefreshUser(Guid gUSER_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshUser";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_RefreshUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshUser
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_RefreshUser(Guid gUSER_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshUser";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_RefreshUser
		/// <summary>
		/// spTEAM_MEMBERSHIPS_RefreshUser
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_RefreshUser(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_RefreshUser";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_Update
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Update
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_Update(Guid gTEAM_ID, Guid gUSER_ID, bool bEXPLICIT_ASSIGN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_MEMBERSHIPS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parEXPLICIT_ASSIGN  = Sql.AddParameter(cmd, "@EXPLICIT_ASSIGN" , bEXPLICIT_ASSIGN   );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_Update
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Update
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_Update(Guid gTEAM_ID, Guid gUSER_ID, bool bEXPLICIT_ASSIGN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_MEMBERSHIPS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parEXPLICIT_ASSIGN  = Sql.AddParameter(cmd, "@EXPLICIT_ASSIGN" , bEXPLICIT_ASSIGN   );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_Update
		/// <summary>
		/// spTEAM_MEMBERSHIPS_Update
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_MEMBERSHIPS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parEXPLICIT_ASSIGN  = Sql.CreateParameter(cmd, "@EXPLICIT_ASSIGN" , "bool",   1);
			return cmd;
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_UpdateImplicit
		/// <summary>
		/// spTEAM_MEMBERSHIPS_UpdateImplicit
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_UpdateImplicit(Guid gTEAM_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImpli";
							else
								cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImplicit";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_MEMBERSHIPS_UpdateImplicit
		/// <summary>
		/// spTEAM_MEMBERSHIPS_UpdateImplicit
		/// </summary>
		public static void spTEAM_MEMBERSHIPS_UpdateImplicit(Guid gTEAM_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImpli";
				else
					cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImplicit";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_MEMBERSHIPS_UpdateImplicit
		/// <summary>
		/// spTEAM_MEMBERSHIPS_UpdateImplicit
		/// </summary>
		public static IDbCommand cmdTEAM_MEMBERSHIPS_UpdateImplicit(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImpli";
			else
				cmd.CommandText = "spTEAM_MEMBERSHIPS_UpdateImplicit";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_NOTICES_Delete
		/// <summary>
		/// spTEAM_NOTICES_Delete
		/// </summary>
		public static void spTEAM_NOTICES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_NOTICES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_NOTICES_Delete
		/// <summary>
		/// spTEAM_NOTICES_Delete
		/// </summary>
		public static void spTEAM_NOTICES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_NOTICES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_NOTICES_Delete
		/// <summary>
		/// spTEAM_NOTICES_Delete
		/// </summary>
		public static IDbCommand cmdTEAM_NOTICES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_NOTICES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_NOTICES_MassDelete
		/// <summary>
		/// spTEAM_NOTICES_MassDelete
		/// </summary>
		public static void spTEAM_NOTICES_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_NOTICES_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_NOTICES_MassDelete
		/// <summary>
		/// spTEAM_NOTICES_MassDelete
		/// </summary>
		public static void spTEAM_NOTICES_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_NOTICES_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_NOTICES_MassDelete
		/// <summary>
		/// spTEAM_NOTICES_MassDelete
		/// </summary>
		public static IDbCommand cmdTEAM_NOTICES_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_NOTICES_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAM_NOTICES_MassUpdate
		/// <summary>
		/// spTEAM_NOTICES_MassUpdate
		/// </summary>
		public static void spTEAM_NOTICES_MassUpdate(string sID_LIST, DateTime dtDATE_START, DateTime dtDATE_END)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_NOTICES_MassUpdate";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parDATE_START       = Sql.AddParameter(cmd, "@DATE_START"      , dtDATE_START       );
							IDbDataParameter parDATE_END         = Sql.AddParameter(cmd, "@DATE_END"        , dtDATE_END         );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_NOTICES_MassUpdate
		/// <summary>
		/// spTEAM_NOTICES_MassUpdate
		/// </summary>
		public static void spTEAM_NOTICES_MassUpdate(string sID_LIST, DateTime dtDATE_START, DateTime dtDATE_END, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_NOTICES_MassUpdate";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parDATE_START       = Sql.AddParameter(cmd, "@DATE_START"      , dtDATE_START       );
				IDbDataParameter parDATE_END         = Sql.AddParameter(cmd, "@DATE_END"        , dtDATE_END         );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAM_NOTICES_MassUpdate
		/// <summary>
		/// spTEAM_NOTICES_MassUpdate
		/// </summary>
		public static IDbCommand cmdTEAM_NOTICES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_NOTICES_MassUpdate";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parDATE_START       = Sql.CreateParameter(cmd, "@DATE_START"      , "DateTime",   8);
			IDbDataParameter parDATE_END         = Sql.CreateParameter(cmd, "@DATE_END"        , "DateTime",   8);
			return cmd;
		}
		#endregion

		#region spTEAM_NOTICES_Update
		/// <summary>
		/// spTEAM_NOTICES_Update
		/// </summary>
		public static void spTEAM_NOTICES_Update(ref Guid gID, Guid gTEAM_ID, string sNAME, string sSTATUS, DateTime dtDATE_START, DateTime dtDATE_END, string sURL, string sURL_TITLE, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAM_NOTICES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
							IDbDataParameter parDATE_START       = Sql.AddParameter(cmd, "@DATE_START"      , dtDATE_START       );
							IDbDataParameter parDATE_END         = Sql.AddParameter(cmd, "@DATE_END"        , dtDATE_END         );
							IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
							IDbDataParameter parURL_TITLE        = Sql.AddParameter(cmd, "@URL_TITLE"       , sURL_TITLE         , 255);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAM_NOTICES_Update
		/// <summary>
		/// spTEAM_NOTICES_Update
		/// </summary>
		public static void spTEAM_NOTICES_Update(ref Guid gID, Guid gTEAM_ID, string sNAME, string sSTATUS, DateTime dtDATE_START, DateTime dtDATE_END, string sURL, string sURL_TITLE, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAM_NOTICES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parTEAM_ID          = Sql.AddParameter(cmd, "@TEAM_ID"         , gTEAM_ID           );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parSTATUS           = Sql.AddParameter(cmd, "@STATUS"          , sSTATUS            ,  25);
				IDbDataParameter parDATE_START       = Sql.AddParameter(cmd, "@DATE_START"      , dtDATE_START       );
				IDbDataParameter parDATE_END         = Sql.AddParameter(cmd, "@DATE_END"        , dtDATE_END         );
				IDbDataParameter parURL              = Sql.AddParameter(cmd, "@URL"             , sURL               , 255);
				IDbDataParameter parURL_TITLE        = Sql.AddParameter(cmd, "@URL_TITLE"       , sURL_TITLE         , 255);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTEAM_NOTICES_Update
		/// <summary>
		/// spTEAM_NOTICES_Update
		/// </summary>
		public static IDbCommand cmdTEAM_NOTICES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAM_NOTICES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parTEAM_ID          = Sql.CreateParameter(cmd, "@TEAM_ID"         , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parSTATUS           = Sql.CreateParameter(cmd, "@STATUS"          , "string",  25);
			IDbDataParameter parDATE_START       = Sql.CreateParameter(cmd, "@DATE_START"      , "DateTime",   8);
			IDbDataParameter parDATE_END         = Sql.CreateParameter(cmd, "@DATE_END"        , "DateTime",   8);
			IDbDataParameter parURL              = Sql.CreateParameter(cmd, "@URL"             , "string", 255);
			IDbDataParameter parURL_TITLE        = Sql.CreateParameter(cmd, "@URL_TITLE"       , "string", 255);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTEAMS_Delete
		/// <summary>
		/// spTEAMS_Delete
		/// </summary>
		public static void spTEAMS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_Delete
		/// <summary>
		/// spTEAMS_Delete
		/// </summary>
		public static void spTEAMS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAMS_Delete
		/// <summary>
		/// spTEAMS_Delete
		/// </summary>
		public static IDbCommand cmdTEAMS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAMS_InitPrivate
		/// <summary>
		/// spTEAMS_InitPrivate
		/// </summary>
		public static void spTEAMS_InitPrivate()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_InitPrivate";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_InitPrivate
		/// <summary>
		/// spTEAMS_InitPrivate
		/// </summary>
		public static void spTEAMS_InitPrivate(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_InitPrivate";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAMS_InitPrivate
		/// <summary>
		/// spTEAMS_InitPrivate
		/// </summary>
		public static IDbCommand cmdTEAMS_InitPrivate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_InitPrivate";
			return cmd;
		}
		#endregion

		#region spTEAMS_InsertOnly
		/// <summary>
		/// spTEAMS_InsertOnly
		/// </summary>
		public static void spTEAMS_InsertOnly(Guid gID, string sNAME, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_InsertOnly";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parNAME        = Sql.AddParameter(cmd, "@NAME"       , sNAME         , 128);
							IDbDataParameter parDESCRIPTION = Sql.AddParameter(cmd, "@DESCRIPTION", sDESCRIPTION  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_InsertOnly
		/// <summary>
		/// spTEAMS_InsertOnly
		/// </summary>
		public static void spTEAMS_InsertOnly(Guid gID, string sNAME, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_InsertOnly";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parNAME        = Sql.AddParameter(cmd, "@NAME"       , sNAME         , 128);
				IDbDataParameter parDESCRIPTION = Sql.AddParameter(cmd, "@DESCRIPTION", sDESCRIPTION  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAMS_InsertOnly
		/// <summary>
		/// spTEAMS_InsertOnly
		/// </summary>
		public static IDbCommand cmdTEAMS_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_InsertOnly";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parNAME        = Sql.CreateParameter(cmd, "@NAME"       , "string", 128);
			IDbDataParameter parDESCRIPTION = Sql.CreateParameter(cmd, "@DESCRIPTION", "string", 104857600);
			return cmd;
		}
		#endregion

		#region spTEAMS_InsertPrivate
		/// <summary>
		/// spTEAMS_InsertPrivate
		/// </summary>
		public static void spTEAMS_InsertPrivate(Guid gUSER_ID, string sUSER_NAME, string sFULL_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_InsertPrivate";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
							IDbDataParameter parFULL_NAME        = Sql.AddParameter(cmd, "@FULL_NAME"       , sFULL_NAME         , 100);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_InsertPrivate
		/// <summary>
		/// spTEAMS_InsertPrivate
		/// </summary>
		public static void spTEAMS_InsertPrivate(Guid gUSER_ID, string sUSER_NAME, string sFULL_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_InsertPrivate";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
				IDbDataParameter parFULL_NAME        = Sql.AddParameter(cmd, "@FULL_NAME"       , sFULL_NAME         , 100);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAMS_InsertPrivate
		/// <summary>
		/// spTEAMS_InsertPrivate
		/// </summary>
		public static IDbCommand cmdTEAMS_InsertPrivate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_InsertPrivate";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parUSER_NAME        = Sql.CreateParameter(cmd, "@USER_NAME"       , "string",  20);
			IDbDataParameter parFULL_NAME        = Sql.CreateParameter(cmd, "@FULL_NAME"       , "string", 100);
			return cmd;
		}
		#endregion

		#region spTEAMS_MassDelete
		/// <summary>
		/// spTEAMS_MassDelete
		/// </summary>
		public static void spTEAMS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_MassDelete
		/// <summary>
		/// spTEAMS_MassDelete
		/// </summary>
		public static void spTEAMS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTEAMS_MassDelete
		/// <summary>
		/// spTEAMS_MassDelete
		/// </summary>
		public static IDbCommand cmdTEAMS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTEAMS_Update
		/// <summary>
		/// spTEAMS_Update
		/// </summary>
		public static void spTEAMS_Update(ref Guid gID, string sNAME, string sDESCRIPTION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTEAMS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 128);
							IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTEAMS_Update
		/// <summary>
		/// spTEAMS_Update
		/// </summary>
		public static void spTEAMS_Update(ref Guid gID, string sNAME, string sDESCRIPTION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTEAMS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 128);
				IDbDataParameter parDESCRIPTION      = Sql.AddParameter(cmd, "@DESCRIPTION"     , sDESCRIPTION       );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTEAMS_Update
		/// <summary>
		/// spTEAMS_Update
		/// </summary>
		public static IDbCommand cmdTEAMS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTEAMS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 128);
			IDbDataParameter parDESCRIPTION      = Sql.CreateParameter(cmd, "@DESCRIPTION"     , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_Delete
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Delete
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_ALIASES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_Delete
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Delete
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_ALIASES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_ALIASES_Delete
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Delete
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_ALIASES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_ALIASES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_ALIASES_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_InsertOnly(string sALIAS_NAME, string sALIAS_MODULE_NAME, string sALIAS_LIST_NAME, string sNAME, string sMODULE_NAME, string sLIST_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOn";
							else
								cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOnly";
							IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
							IDbDataParameter parALIAS_NAME        = Sql.AddParameter(cmd, "@ALIAS_NAME"       , sALIAS_NAME         ,  50);
							IDbDataParameter parALIAS_MODULE_NAME = Sql.AddParameter(cmd, "@ALIAS_MODULE_NAME", sALIAS_MODULE_NAME  ,  25);
							IDbDataParameter parALIAS_LIST_NAME   = Sql.AddParameter(cmd, "@ALIAS_LIST_NAME"  , sALIAS_LIST_NAME    ,  50);
							IDbDataParameter parNAME              = Sql.AddParameter(cmd, "@NAME"             , sNAME               ,  50);
							IDbDataParameter parMODULE_NAME       = Sql.AddParameter(cmd, "@MODULE_NAME"      , sMODULE_NAME        ,  25);
							IDbDataParameter parLIST_NAME         = Sql.AddParameter(cmd, "@LIST_NAME"        , sLIST_NAME          ,  50);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_ALIASES_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_InsertOnly(string sALIAS_NAME, string sALIAS_MODULE_NAME, string sALIAS_LIST_NAME, string sNAME, string sMODULE_NAME, string sLIST_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOn";
				else
					cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOnly";
				IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
				IDbDataParameter parALIAS_NAME        = Sql.AddParameter(cmd, "@ALIAS_NAME"       , sALIAS_NAME         ,  50);
				IDbDataParameter parALIAS_MODULE_NAME = Sql.AddParameter(cmd, "@ALIAS_MODULE_NAME", sALIAS_MODULE_NAME  ,  25);
				IDbDataParameter parALIAS_LIST_NAME   = Sql.AddParameter(cmd, "@ALIAS_LIST_NAME"  , sALIAS_LIST_NAME    ,  50);
				IDbDataParameter parNAME              = Sql.AddParameter(cmd, "@NAME"             , sNAME               ,  50);
				IDbDataParameter parMODULE_NAME       = Sql.AddParameter(cmd, "@MODULE_NAME"      , sMODULE_NAME        ,  25);
				IDbDataParameter parLIST_NAME         = Sql.AddParameter(cmd, "@LIST_NAME"        , sLIST_NAME          ,  50);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_ALIASES_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_ALIASES_InsertOnly
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_ALIASES_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOn";
			else
				cmd.CommandText = "spTERMINOLOGY_ALIASES_InsertOnly";
			IDbDataParameter parMODIFIED_USER_ID  = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID" , "Guid",  16);
			IDbDataParameter parALIAS_NAME        = Sql.CreateParameter(cmd, "@ALIAS_NAME"       , "string",  50);
			IDbDataParameter parALIAS_MODULE_NAME = Sql.CreateParameter(cmd, "@ALIAS_MODULE_NAME", "string",  25);
			IDbDataParameter parALIAS_LIST_NAME   = Sql.CreateParameter(cmd, "@ALIAS_LIST_NAME"  , "string",  50);
			IDbDataParameter parNAME              = Sql.CreateParameter(cmd, "@NAME"             , "string",  50);
			IDbDataParameter parMODULE_NAME       = Sql.CreateParameter(cmd, "@MODULE_NAME"      , "string",  25);
			IDbDataParameter parLIST_NAME         = Sql.CreateParameter(cmd, "@LIST_NAME"        , "string",  50);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_Update
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Update
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_Update(ref Guid gID, string sALIAS_NAME, string sALIAS_MODULE_NAME, string sALIAS_LIST_NAME, string sNAME, string sMODULE_NAME, string sLIST_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_ALIASES_Update";
							IDbDataParameter parID                = Sql.AddParameter(cmd, "@ID"               , gID                 );
							IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
							IDbDataParameter parALIAS_NAME        = Sql.AddParameter(cmd, "@ALIAS_NAME"       , sALIAS_NAME         ,  50);
							IDbDataParameter parALIAS_MODULE_NAME = Sql.AddParameter(cmd, "@ALIAS_MODULE_NAME", sALIAS_MODULE_NAME  ,  25);
							IDbDataParameter parALIAS_LIST_NAME   = Sql.AddParameter(cmd, "@ALIAS_LIST_NAME"  , sALIAS_LIST_NAME    ,  50);
							IDbDataParameter parNAME              = Sql.AddParameter(cmd, "@NAME"             , sNAME               ,  50);
							IDbDataParameter parMODULE_NAME       = Sql.AddParameter(cmd, "@MODULE_NAME"      , sMODULE_NAME        ,  25);
							IDbDataParameter parLIST_NAME         = Sql.AddParameter(cmd, "@LIST_NAME"        , sLIST_NAME          ,  50);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_ALIASES_Update
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Update
		/// </summary>
		public static void spTERMINOLOGY_ALIASES_Update(ref Guid gID, string sALIAS_NAME, string sALIAS_MODULE_NAME, string sALIAS_LIST_NAME, string sNAME, string sMODULE_NAME, string sLIST_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_ALIASES_Update";
				IDbDataParameter parID                = Sql.AddParameter(cmd, "@ID"               , gID                 );
				IDbDataParameter parMODIFIED_USER_ID  = Sql.AddParameter(cmd, "@MODIFIED_USER_ID" ,  Security.USER_ID   );
				IDbDataParameter parALIAS_NAME        = Sql.AddParameter(cmd, "@ALIAS_NAME"       , sALIAS_NAME         ,  50);
				IDbDataParameter parALIAS_MODULE_NAME = Sql.AddParameter(cmd, "@ALIAS_MODULE_NAME", sALIAS_MODULE_NAME  ,  25);
				IDbDataParameter parALIAS_LIST_NAME   = Sql.AddParameter(cmd, "@ALIAS_LIST_NAME"  , sALIAS_LIST_NAME    ,  50);
				IDbDataParameter parNAME              = Sql.AddParameter(cmd, "@NAME"             , sNAME               ,  50);
				IDbDataParameter parMODULE_NAME       = Sql.AddParameter(cmd, "@MODULE_NAME"      , sMODULE_NAME        ,  25);
				IDbDataParameter parLIST_NAME         = Sql.AddParameter(cmd, "@LIST_NAME"        , sLIST_NAME          ,  50);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTERMINOLOGY_ALIASES_Update
		/// <summary>
		/// spTERMINOLOGY_ALIASES_Update
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_ALIASES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_ALIASES_Update";
			IDbDataParameter parID                = Sql.CreateParameter(cmd, "@ID"               , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID  = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID" , "Guid",  16);
			IDbDataParameter parALIAS_NAME        = Sql.CreateParameter(cmd, "@ALIAS_NAME"       , "string",  50);
			IDbDataParameter parALIAS_MODULE_NAME = Sql.CreateParameter(cmd, "@ALIAS_MODULE_NAME", "string",  25);
			IDbDataParameter parALIAS_LIST_NAME   = Sql.CreateParameter(cmd, "@ALIAS_LIST_NAME"  , "string",  50);
			IDbDataParameter parNAME              = Sql.CreateParameter(cmd, "@NAME"             , "string",  50);
			IDbDataParameter parMODULE_NAME       = Sql.CreateParameter(cmd, "@MODULE_NAME"      , "string",  25);
			IDbDataParameter parLIST_NAME         = Sql.CreateParameter(cmd, "@LIST_NAME"        , "string",  50);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_Delete
		/// <summary>
		/// spTERMINOLOGY_Delete
		/// </summary>
		public static void spTERMINOLOGY_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_Delete
		/// <summary>
		/// spTERMINOLOGY_Delete
		/// </summary>
		public static void spTERMINOLOGY_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_Delete
		/// <summary>
		/// spTERMINOLOGY_Delete
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_DeleteAll
		/// <summary>
		/// spTERMINOLOGY_DeleteAll
		/// </summary>
		public static void spTERMINOLOGY_DeleteAll(string sLANG)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_DeleteAll";
							IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_DeleteAll
		/// <summary>
		/// spTERMINOLOGY_DeleteAll
		/// </summary>
		public static void spTERMINOLOGY_DeleteAll(string sLANG, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_DeleteAll";
				IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_DeleteAll
		/// <summary>
		/// spTERMINOLOGY_DeleteAll
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_DeleteAll(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_DeleteAll";
			IDbDataParameter parLANG             = Sql.CreateParameter(cmd, "@LANG"            , "string",  10);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_HELP_Delete
		/// <summary>
		/// spTERMINOLOGY_HELP_Delete
		/// </summary>
		public static void spTERMINOLOGY_HELP_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_HELP_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_HELP_Delete
		/// <summary>
		/// spTERMINOLOGY_HELP_Delete
		/// </summary>
		public static void spTERMINOLOGY_HELP_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_HELP_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_HELP_Delete
		/// <summary>
		/// spTERMINOLOGY_HELP_Delete
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_HELP_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_HELP_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_HELP_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_HELP_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_HELP_InsertOnly(string sNAME, string sLANG, string sMODULE_NAME, string sDISPLAY_TEXT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_HELP_InsertOnly";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
							IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
							IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
							IDbDataParameter parDISPLAY_TEXT = Sql.AddParameter(cmd, "@DISPLAY_TEXT", sDISPLAY_TEXT  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_HELP_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_HELP_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_HELP_InsertOnly(string sNAME, string sLANG, string sMODULE_NAME, string sDISPLAY_TEXT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_HELP_InsertOnly";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
				IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
				IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
				IDbDataParameter parDISPLAY_TEXT = Sql.AddParameter(cmd, "@DISPLAY_TEXT", sDISPLAY_TEXT  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_HELP_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_HELP_InsertOnly
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_HELP_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_HELP_InsertOnly";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  50);
			IDbDataParameter parLANG         = Sql.CreateParameter(cmd, "@LANG"        , "string",  10);
			IDbDataParameter parMODULE_NAME  = Sql.CreateParameter(cmd, "@MODULE_NAME" , "string",  25);
			IDbDataParameter parDISPLAY_TEXT = Sql.CreateParameter(cmd, "@DISPLAY_TEXT", "string", 104857600);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_HELP_Update
		/// <summary>
		/// spTERMINOLOGY_HELP_Update
		/// </summary>
		public static void spTERMINOLOGY_HELP_Update(ref Guid gID, string sNAME, string sLANG, string sMODULE_NAME, string sDISPLAY_TEXT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_HELP_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
							IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parDISPLAY_TEXT     = Sql.AddParameter(cmd, "@DISPLAY_TEXT"    , sDISPLAY_TEXT      );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_HELP_Update
		/// <summary>
		/// spTERMINOLOGY_HELP_Update
		/// </summary>
		public static void spTERMINOLOGY_HELP_Update(ref Guid gID, string sNAME, string sLANG, string sMODULE_NAME, string sDISPLAY_TEXT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_HELP_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  50);
				IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parDISPLAY_TEXT     = Sql.AddParameter(cmd, "@DISPLAY_TEXT"    , sDISPLAY_TEXT      );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTERMINOLOGY_HELP_Update
		/// <summary>
		/// spTERMINOLOGY_HELP_Update
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_HELP_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_HELP_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  50);
			IDbDataParameter parLANG             = Sql.CreateParameter(cmd, "@LANG"            , "string",  10);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parDISPLAY_TEXT     = Sql.CreateParameter(cmd, "@DISPLAY_TEXT"    , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_InsertOnly(string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_InsertOnly";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
							IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
							IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
							IDbDataParameter parLIST_NAME    = Sql.AddParameter(cmd, "@LIST_NAME"   , sLIST_NAME     ,  50);
							IDbDataParameter parLIST_ORDER   = Sql.AddParameter(cmd, "@LIST_ORDER"  , nLIST_ORDER    );
							IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  , 2000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_InsertOnly
		/// </summary>
		public static void spTERMINOLOGY_InsertOnly(string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_InsertOnly";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
				IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
				IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
				IDbDataParameter parLIST_NAME    = Sql.AddParameter(cmd, "@LIST_NAME"   , sLIST_NAME     ,  50);
				IDbDataParameter parLIST_ORDER   = Sql.AddParameter(cmd, "@LIST_ORDER"  , nLIST_ORDER    );
				IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  , 2000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_InsertOnly
		/// <summary>
		/// spTERMINOLOGY_InsertOnly
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_InsertOnly";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  50);
			IDbDataParameter parLANG         = Sql.CreateParameter(cmd, "@LANG"        , "string",  10);
			IDbDataParameter parMODULE_NAME  = Sql.CreateParameter(cmd, "@MODULE_NAME" , "string",  25);
			IDbDataParameter parLIST_NAME    = Sql.CreateParameter(cmd, "@LIST_NAME"   , "string",  50);
			IDbDataParameter parLIST_ORDER   = Sql.CreateParameter(cmd, "@LIST_ORDER"  , "Int32",   4);
			IDbDataParameter parDISPLAY_NAME = Sql.CreateParameter(cmd, "@DISPLAY_NAME", "string", 2000);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_LIST_Delete
		/// <summary>
		/// spTERMINOLOGY_LIST_Delete
		/// </summary>
		public static void spTERMINOLOGY_LIST_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_LIST_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_LIST_Delete
		/// <summary>
		/// spTERMINOLOGY_LIST_Delete
		/// </summary>
		public static void spTERMINOLOGY_LIST_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_LIST_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_LIST_Delete
		/// <summary>
		/// spTERMINOLOGY_LIST_Delete
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_LIST_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_LIST_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_LIST_Insert
		/// <summary>
		/// spTERMINOLOGY_LIST_Insert
		/// </summary>
		public static void spTERMINOLOGY_LIST_Insert(ref Guid gID, string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_LIST_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  25);
							IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parLIST_NAME        = Sql.AddParameter(cmd, "@LIST_NAME"       , sLIST_NAME         ,  50);
							IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
							IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 2000);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_LIST_Insert
		/// <summary>
		/// spTERMINOLOGY_LIST_Insert
		/// </summary>
		public static void spTERMINOLOGY_LIST_Insert(ref Guid gID, string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_LIST_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  25);
				IDbDataParameter parLANG             = Sql.AddParameter(cmd, "@LANG"            , sLANG              ,  10);
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parLIST_NAME        = Sql.AddParameter(cmd, "@LIST_NAME"       , sLIST_NAME         ,  50);
				IDbDataParameter parLIST_ORDER       = Sql.AddParameter(cmd, "@LIST_ORDER"      , nLIST_ORDER        );
				IDbDataParameter parDISPLAY_NAME     = Sql.AddParameter(cmd, "@DISPLAY_NAME"    , sDISPLAY_NAME      , 2000);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTERMINOLOGY_LIST_Insert
		/// <summary>
		/// spTERMINOLOGY_LIST_Insert
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_LIST_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_LIST_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  25);
			IDbDataParameter parLANG             = Sql.CreateParameter(cmd, "@LANG"            , "string",  10);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parLIST_NAME        = Sql.CreateParameter(cmd, "@LIST_NAME"       , "string",  50);
			IDbDataParameter parLIST_ORDER       = Sql.CreateParameter(cmd, "@LIST_ORDER"      , "Int32",   4);
			IDbDataParameter parDISPLAY_NAME     = Sql.CreateParameter(cmd, "@DISPLAY_NAME"    , "string", 2000);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_LIST_MoveDown
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveDown
		/// </summary>
		public static void spTERMINOLOGY_LIST_MoveDown(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_LIST_MoveDown";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_LIST_MoveDown
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveDown
		/// </summary>
		public static void spTERMINOLOGY_LIST_MoveDown(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_LIST_MoveDown";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_LIST_MoveDown
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveDown
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_LIST_MoveDown(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_LIST_MoveDown";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_LIST_MoveUp
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveUp
		/// </summary>
		public static void spTERMINOLOGY_LIST_MoveUp(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_LIST_MoveUp";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_LIST_MoveUp
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveUp
		/// </summary>
		public static void spTERMINOLOGY_LIST_MoveUp(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_LIST_MoveUp";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_LIST_MoveUp
		/// <summary>
		/// spTERMINOLOGY_LIST_MoveUp
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_LIST_MoveUp(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_LIST_MoveUp";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_MassDelete
		/// <summary>
		/// spTERMINOLOGY_MassDelete
		/// </summary>
		public static void spTERMINOLOGY_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_MassDelete
		/// <summary>
		/// spTERMINOLOGY_MassDelete
		/// </summary>
		public static void spTERMINOLOGY_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_MassDelete
		/// <summary>
		/// spTERMINOLOGY_MassDelete
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTERMINOLOGY_Update
		/// <summary>
		/// spTERMINOLOGY_Update
		/// </summary>
		public static void spTERMINOLOGY_Update(string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTERMINOLOGY_Update";
							IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
							IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
							IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
							IDbDataParameter parLIST_NAME    = Sql.AddParameter(cmd, "@LIST_NAME"   , sLIST_NAME     ,  50);
							IDbDataParameter parLIST_ORDER   = Sql.AddParameter(cmd, "@LIST_ORDER"  , nLIST_ORDER    );
							IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  , 2000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTERMINOLOGY_Update
		/// <summary>
		/// spTERMINOLOGY_Update
		/// </summary>
		public static void spTERMINOLOGY_Update(string sNAME, string sLANG, string sMODULE_NAME, string sLIST_NAME, Int32 nLIST_ORDER, string sDISPLAY_NAME, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTERMINOLOGY_Update";
				IDbDataParameter parNAME         = Sql.AddParameter(cmd, "@NAME"        , sNAME          ,  50);
				IDbDataParameter parLANG         = Sql.AddParameter(cmd, "@LANG"        , sLANG          ,  10);
				IDbDataParameter parMODULE_NAME  = Sql.AddParameter(cmd, "@MODULE_NAME" , sMODULE_NAME   ,  25);
				IDbDataParameter parLIST_NAME    = Sql.AddParameter(cmd, "@LIST_NAME"   , sLIST_NAME     ,  50);
				IDbDataParameter parLIST_ORDER   = Sql.AddParameter(cmd, "@LIST_ORDER"  , nLIST_ORDER    );
				IDbDataParameter parDISPLAY_NAME = Sql.AddParameter(cmd, "@DISPLAY_NAME", sDISPLAY_NAME  , 2000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTERMINOLOGY_Update
		/// <summary>
		/// spTERMINOLOGY_Update
		/// </summary>
		public static IDbCommand cmdTERMINOLOGY_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTERMINOLOGY_Update";
			IDbDataParameter parNAME         = Sql.CreateParameter(cmd, "@NAME"        , "string",  50);
			IDbDataParameter parLANG         = Sql.CreateParameter(cmd, "@LANG"        , "string",  10);
			IDbDataParameter parMODULE_NAME  = Sql.CreateParameter(cmd, "@MODULE_NAME" , "string",  25);
			IDbDataParameter parLIST_NAME    = Sql.CreateParameter(cmd, "@LIST_NAME"   , "string",  50);
			IDbDataParameter parLIST_ORDER   = Sql.CreateParameter(cmd, "@LIST_ORDER"  , "Int32",   4);
			IDbDataParameter parDISPLAY_NAME = Sql.CreateParameter(cmd, "@DISPLAY_NAME", "string", 2000);
			return cmd;
		}
		#endregion

		#region spTHREADS_Delete
		/// <summary>
		/// spTHREADS_Delete
		/// </summary>
		public static void spTHREADS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTHREADS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTHREADS_Delete
		/// <summary>
		/// spTHREADS_Delete
		/// </summary>
		public static void spTHREADS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTHREADS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTHREADS_Delete
		/// <summary>
		/// spTHREADS_Delete
		/// </summary>
		public static IDbCommand cmdTHREADS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTHREADS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTHREADS_IncrementViewCount
		/// <summary>
		/// spTHREADS_IncrementViewCount
		/// </summary>
		public static void spTHREADS_IncrementViewCount(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTHREADS_IncrementViewCount";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTHREADS_IncrementViewCount
		/// <summary>
		/// spTHREADS_IncrementViewCount
		/// </summary>
		public static void spTHREADS_IncrementViewCount(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTHREADS_IncrementViewCount";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTHREADS_IncrementViewCount
		/// <summary>
		/// spTHREADS_IncrementViewCount
		/// </summary>
		public static IDbCommand cmdTHREADS_IncrementViewCount(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTHREADS_IncrementViewCount";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTHREADS_Update
		/// <summary>
		/// spTHREADS_Update
		/// </summary>
		public static void spTHREADS_Update(ref Guid gID, Guid gFORUM_ID, Guid gPARENT_ID, string sTITLE, bool bIS_STICKY, string sDESCRIPTION_HTML)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTHREADS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFORUM_ID         = Sql.AddParameter(cmd, "@FORUM_ID"        , gFORUM_ID          );
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 255);
							IDbDataParameter parIS_STICKY        = Sql.AddParameter(cmd, "@IS_STICKY"       , bIS_STICKY         );
							IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTHREADS_Update
		/// <summary>
		/// spTHREADS_Update
		/// </summary>
		public static void spTHREADS_Update(ref Guid gID, Guid gFORUM_ID, Guid gPARENT_ID, string sTITLE, bool bIS_STICKY, string sDESCRIPTION_HTML, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTHREADS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFORUM_ID         = Sql.AddParameter(cmd, "@FORUM_ID"        , gFORUM_ID          );
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parTITLE            = Sql.AddParameter(cmd, "@TITLE"           , sTITLE             , 255);
				IDbDataParameter parIS_STICKY        = Sql.AddParameter(cmd, "@IS_STICKY"       , bIS_STICKY         );
				IDbDataParameter parDESCRIPTION_HTML = Sql.AddParameter(cmd, "@DESCRIPTION_HTML", sDESCRIPTION_HTML  );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTHREADS_Update
		/// <summary>
		/// spTHREADS_Update
		/// </summary>
		public static IDbCommand cmdTHREADS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTHREADS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFORUM_ID         = Sql.CreateParameter(cmd, "@FORUM_ID"        , "Guid",  16);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parTITLE            = Sql.CreateParameter(cmd, "@TITLE"           , "string", 255);
			IDbDataParameter parIS_STICKY        = Sql.CreateParameter(cmd, "@IS_STICKY"       , "bool",   1);
			IDbDataParameter parDESCRIPTION_HTML = Sql.CreateParameter(cmd, "@DESCRIPTION_HTML", "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTHREADS_UpdatePostCount
		/// <summary>
		/// spTHREADS_UpdatePostCount
		/// </summary>
		public static void spTHREADS_UpdatePostCount(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTHREADS_UpdatePostCount";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTHREADS_UpdatePostCount
		/// <summary>
		/// spTHREADS_UpdatePostCount
		/// </summary>
		public static void spTHREADS_UpdatePostCount(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTHREADS_UpdatePostCount";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTHREADS_UpdatePostCount
		/// <summary>
		/// spTHREADS_UpdatePostCount
		/// </summary>
		public static IDbCommand cmdTHREADS_UpdatePostCount(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTHREADS_UpdatePostCount";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTIME_PERIODS_Delete
		/// <summary>
		/// spTIME_PERIODS_Delete
		/// </summary>
		public static void spTIME_PERIODS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIME_PERIODS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIME_PERIODS_Delete
		/// <summary>
		/// spTIME_PERIODS_Delete
		/// </summary>
		public static void spTIME_PERIODS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIME_PERIODS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTIME_PERIODS_Delete
		/// <summary>
		/// spTIME_PERIODS_Delete
		/// </summary>
		public static IDbCommand cmdTIME_PERIODS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIME_PERIODS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTIME_PERIODS_Update
		/// <summary>
		/// spTIME_PERIODS_Update
		/// </summary>
		public static void spTIME_PERIODS_Update(ref Guid gID, string sNAME, Guid gPARENT_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, bool bIS_FISCAL_YEAR)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIME_PERIODS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  25);
							IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
							IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
							IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
							IDbDataParameter parIS_FISCAL_YEAR   = Sql.AddParameter(cmd, "@IS_FISCAL_YEAR"  , bIS_FISCAL_YEAR    );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIME_PERIODS_Update
		/// <summary>
		/// spTIME_PERIODS_Update
		/// </summary>
		public static void spTIME_PERIODS_Update(ref Guid gID, string sNAME, Guid gPARENT_ID, DateTime dtSTART_DATE, DateTime dtEND_DATE, bool bIS_FISCAL_YEAR, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIME_PERIODS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              ,  25);
				IDbDataParameter parPARENT_ID        = Sql.AddParameter(cmd, "@PARENT_ID"       , gPARENT_ID         );
				IDbDataParameter parSTART_DATE       = Sql.AddParameter(cmd, "@START_DATE"      , dtSTART_DATE       );
				IDbDataParameter parEND_DATE         = Sql.AddParameter(cmd, "@END_DATE"        , dtEND_DATE         );
				IDbDataParameter parIS_FISCAL_YEAR   = Sql.AddParameter(cmd, "@IS_FISCAL_YEAR"  , bIS_FISCAL_YEAR    );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTIME_PERIODS_Update
		/// <summary>
		/// spTIME_PERIODS_Update
		/// </summary>
		public static IDbCommand cmdTIME_PERIODS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIME_PERIODS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string",  25);
			IDbDataParameter parPARENT_ID        = Sql.CreateParameter(cmd, "@PARENT_ID"       , "Guid",  16);
			IDbDataParameter parSTART_DATE       = Sql.CreateParameter(cmd, "@START_DATE"      , "DateTime",   8);
			IDbDataParameter parEND_DATE         = Sql.CreateParameter(cmd, "@END_DATE"        , "DateTime",   8);
			IDbDataParameter parIS_FISCAL_YEAR   = Sql.CreateParameter(cmd, "@IS_FISCAL_YEAR"  , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTIMEZONES_Delete
		/// <summary>
		/// spTIMEZONES_Delete
		/// </summary>
		public static void spTIMEZONES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIMEZONES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIMEZONES_Delete
		/// <summary>
		/// spTIMEZONES_Delete
		/// </summary>
		public static void spTIMEZONES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIMEZONES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTIMEZONES_Delete
		/// <summary>
		/// spTIMEZONES_Delete
		/// </summary>
		public static IDbCommand cmdTIMEZONES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIMEZONES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTIMEZONES_InsertOnly
		/// <summary>
		/// spTIMEZONES_InsertOnly
		/// </summary>
		public static void spTIMEZONES_InsertOnly(Guid gID, string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIMEZONES_InsertOnly";
							IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
							IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
							IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
							IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
							IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
							IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
							IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
							IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
							IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
							IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
							IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
							IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
							IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
							IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
							IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
							IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
							IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
							IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
							IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
							IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
							IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
							IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIMEZONES_InsertOnly
		/// <summary>
		/// spTIMEZONES_InsertOnly
		/// </summary>
		public static void spTIMEZONES_InsertOnly(Guid gID, string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIMEZONES_InsertOnly";
				IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
				IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
				IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
				IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
				IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
				IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
				IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
				IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
				IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
				IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
				IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
				IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
				IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
				IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
				IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
				IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
				IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
				IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
				IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
				IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
				IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
				IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTIMEZONES_InsertOnly
		/// <summary>
		/// spTIMEZONES_InsertOnly
		/// </summary>
		public static IDbCommand cmdTIMEZONES_InsertOnly(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIMEZONES_InsertOnly";
			IDbDataParameter parID                    = Sql.CreateParameter(cmd, "@ID"                   , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID      = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"     , "Guid",  16);
			IDbDataParameter parNAME                  = Sql.CreateParameter(cmd, "@NAME"                 , "string", 100);
			IDbDataParameter parSTANDARD_NAME         = Sql.CreateParameter(cmd, "@STANDARD_NAME"        , "string", 100);
			IDbDataParameter parSTANDARD_ABBREVIATION = Sql.CreateParameter(cmd, "@STANDARD_ABBREVIATION", "string",  10);
			IDbDataParameter parDAYLIGHT_NAME         = Sql.CreateParameter(cmd, "@DAYLIGHT_NAME"        , "string", 100);
			IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.CreateParameter(cmd, "@DAYLIGHT_ABBREVIATION", "string",  10);
			IDbDataParameter parBIAS                  = Sql.CreateParameter(cmd, "@BIAS"                 , "Int32",   4);
			IDbDataParameter parSTANDARD_BIAS         = Sql.CreateParameter(cmd, "@STANDARD_BIAS"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_BIAS         = Sql.CreateParameter(cmd, "@DAYLIGHT_BIAS"        , "Int32",   4);
			IDbDataParameter parSTANDARD_YEAR         = Sql.CreateParameter(cmd, "@STANDARD_YEAR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MONTH        = Sql.CreateParameter(cmd, "@STANDARD_MONTH"       , "Int32",   4);
			IDbDataParameter parSTANDARD_WEEK         = Sql.CreateParameter(cmd, "@STANDARD_WEEK"        , "Int32",   4);
			IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.CreateParameter(cmd, "@STANDARD_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parSTANDARD_HOUR         = Sql.CreateParameter(cmd, "@STANDARD_HOUR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MINUTE       = Sql.CreateParameter(cmd, "@STANDARD_MINUTE"      , "Int32",   4);
			IDbDataParameter parDAYLIGHT_YEAR         = Sql.CreateParameter(cmd, "@DAYLIGHT_YEAR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MONTH        = Sql.CreateParameter(cmd, "@DAYLIGHT_MONTH"       , "Int32",   4);
			IDbDataParameter parDAYLIGHT_WEEK         = Sql.CreateParameter(cmd, "@DAYLIGHT_WEEK"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.CreateParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parDAYLIGHT_HOUR         = Sql.CreateParameter(cmd, "@DAYLIGHT_HOUR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MINUTE       = Sql.CreateParameter(cmd, "@DAYLIGHT_MINUTE"      , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spTIMEZONES_Update
		/// <summary>
		/// spTIMEZONES_Update
		/// </summary>
		public static void spTIMEZONES_Update(ref Guid gID, string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIMEZONES_Update";
							IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
							IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
							IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
							IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
							IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
							IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
							IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
							IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
							IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
							IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
							IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
							IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
							IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
							IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
							IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
							IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
							IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
							IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
							IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
							IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
							IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
							IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIMEZONES_Update
		/// <summary>
		/// spTIMEZONES_Update
		/// </summary>
		public static void spTIMEZONES_Update(ref Guid gID, string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIMEZONES_Update";
				IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
				IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
				IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
				IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
				IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
				IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
				IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
				IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
				IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
				IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
				IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
				IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
				IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
				IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
				IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
				IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
				IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
				IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
				IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
				IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
				IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
				IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdTIMEZONES_Update
		/// <summary>
		/// spTIMEZONES_Update
		/// </summary>
		public static IDbCommand cmdTIMEZONES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIMEZONES_Update";
			IDbDataParameter parID                    = Sql.CreateParameter(cmd, "@ID"                   , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID      = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"     , "Guid",  16);
			IDbDataParameter parNAME                  = Sql.CreateParameter(cmd, "@NAME"                 , "string", 100);
			IDbDataParameter parSTANDARD_NAME         = Sql.CreateParameter(cmd, "@STANDARD_NAME"        , "string", 100);
			IDbDataParameter parSTANDARD_ABBREVIATION = Sql.CreateParameter(cmd, "@STANDARD_ABBREVIATION", "string",  10);
			IDbDataParameter parDAYLIGHT_NAME         = Sql.CreateParameter(cmd, "@DAYLIGHT_NAME"        , "string", 100);
			IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.CreateParameter(cmd, "@DAYLIGHT_ABBREVIATION", "string",  10);
			IDbDataParameter parBIAS                  = Sql.CreateParameter(cmd, "@BIAS"                 , "Int32",   4);
			IDbDataParameter parSTANDARD_BIAS         = Sql.CreateParameter(cmd, "@STANDARD_BIAS"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_BIAS         = Sql.CreateParameter(cmd, "@DAYLIGHT_BIAS"        , "Int32",   4);
			IDbDataParameter parSTANDARD_YEAR         = Sql.CreateParameter(cmd, "@STANDARD_YEAR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MONTH        = Sql.CreateParameter(cmd, "@STANDARD_MONTH"       , "Int32",   4);
			IDbDataParameter parSTANDARD_WEEK         = Sql.CreateParameter(cmd, "@STANDARD_WEEK"        , "Int32",   4);
			IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.CreateParameter(cmd, "@STANDARD_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parSTANDARD_HOUR         = Sql.CreateParameter(cmd, "@STANDARD_HOUR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MINUTE       = Sql.CreateParameter(cmd, "@STANDARD_MINUTE"      , "Int32",   4);
			IDbDataParameter parDAYLIGHT_YEAR         = Sql.CreateParameter(cmd, "@DAYLIGHT_YEAR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MONTH        = Sql.CreateParameter(cmd, "@DAYLIGHT_MONTH"       , "Int32",   4);
			IDbDataParameter parDAYLIGHT_WEEK         = Sql.CreateParameter(cmd, "@DAYLIGHT_WEEK"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.CreateParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parDAYLIGHT_HOUR         = Sql.CreateParameter(cmd, "@DAYLIGHT_HOUR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MINUTE       = Sql.CreateParameter(cmd, "@DAYLIGHT_MINUTE"      , "Int32",   4);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spTIMEZONES_UpdateByName
		/// <summary>
		/// spTIMEZONES_UpdateByName
		/// </summary>
		public static void spTIMEZONES_UpdateByName(string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTIMEZONES_UpdateByName";
							IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
							IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
							IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
							IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
							IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
							IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
							IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
							IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
							IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
							IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
							IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
							IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
							IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
							IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
							IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
							IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
							IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
							IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
							IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
							IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
							IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTIMEZONES_UpdateByName
		/// <summary>
		/// spTIMEZONES_UpdateByName
		/// </summary>
		public static void spTIMEZONES_UpdateByName(string sNAME, string sSTANDARD_NAME, string sSTANDARD_ABBREVIATION, string sDAYLIGHT_NAME, string sDAYLIGHT_ABBREVIATION, Int32 nBIAS, Int32 nSTANDARD_BIAS, Int32 nDAYLIGHT_BIAS, Int32 nSTANDARD_YEAR, Int32 nSTANDARD_MONTH, Int32 nSTANDARD_WEEK, Int32 nSTANDARD_DAYOFWEEK, Int32 nSTANDARD_HOUR, Int32 nSTANDARD_MINUTE, Int32 nDAYLIGHT_YEAR, Int32 nDAYLIGHT_MONTH, Int32 nDAYLIGHT_WEEK, Int32 nDAYLIGHT_DAYOFWEEK, Int32 nDAYLIGHT_HOUR, Int32 nDAYLIGHT_MINUTE, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTIMEZONES_UpdateByName";
				IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
				IDbDataParameter parNAME                  = Sql.AddParameter(cmd, "@NAME"                 , sNAME                   , 100);
				IDbDataParameter parSTANDARD_NAME         = Sql.AddParameter(cmd, "@STANDARD_NAME"        , sSTANDARD_NAME          , 100);
				IDbDataParameter parSTANDARD_ABBREVIATION = Sql.AddParameter(cmd, "@STANDARD_ABBREVIATION", sSTANDARD_ABBREVIATION  ,  10);
				IDbDataParameter parDAYLIGHT_NAME         = Sql.AddParameter(cmd, "@DAYLIGHT_NAME"        , sDAYLIGHT_NAME          , 100);
				IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.AddParameter(cmd, "@DAYLIGHT_ABBREVIATION", sDAYLIGHT_ABBREVIATION  ,  10);
				IDbDataParameter parBIAS                  = Sql.AddParameter(cmd, "@BIAS"                 , nBIAS                   );
				IDbDataParameter parSTANDARD_BIAS         = Sql.AddParameter(cmd, "@STANDARD_BIAS"        , nSTANDARD_BIAS          );
				IDbDataParameter parDAYLIGHT_BIAS         = Sql.AddParameter(cmd, "@DAYLIGHT_BIAS"        , nDAYLIGHT_BIAS          );
				IDbDataParameter parSTANDARD_YEAR         = Sql.AddParameter(cmd, "@STANDARD_YEAR"        , nSTANDARD_YEAR          );
				IDbDataParameter parSTANDARD_MONTH        = Sql.AddParameter(cmd, "@STANDARD_MONTH"       , nSTANDARD_MONTH         );
				IDbDataParameter parSTANDARD_WEEK         = Sql.AddParameter(cmd, "@STANDARD_WEEK"        , nSTANDARD_WEEK          );
				IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.AddParameter(cmd, "@STANDARD_DAYOFWEEK"   , nSTANDARD_DAYOFWEEK     );
				IDbDataParameter parSTANDARD_HOUR         = Sql.AddParameter(cmd, "@STANDARD_HOUR"        , nSTANDARD_HOUR          );
				IDbDataParameter parSTANDARD_MINUTE       = Sql.AddParameter(cmd, "@STANDARD_MINUTE"      , nSTANDARD_MINUTE        );
				IDbDataParameter parDAYLIGHT_YEAR         = Sql.AddParameter(cmd, "@DAYLIGHT_YEAR"        , nDAYLIGHT_YEAR          );
				IDbDataParameter parDAYLIGHT_MONTH        = Sql.AddParameter(cmd, "@DAYLIGHT_MONTH"       , nDAYLIGHT_MONTH         );
				IDbDataParameter parDAYLIGHT_WEEK         = Sql.AddParameter(cmd, "@DAYLIGHT_WEEK"        , nDAYLIGHT_WEEK          );
				IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.AddParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , nDAYLIGHT_DAYOFWEEK     );
				IDbDataParameter parDAYLIGHT_HOUR         = Sql.AddParameter(cmd, "@DAYLIGHT_HOUR"        , nDAYLIGHT_HOUR          );
				IDbDataParameter parDAYLIGHT_MINUTE       = Sql.AddParameter(cmd, "@DAYLIGHT_MINUTE"      , nDAYLIGHT_MINUTE        );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTIMEZONES_UpdateByName
		/// <summary>
		/// spTIMEZONES_UpdateByName
		/// </summary>
		public static IDbCommand cmdTIMEZONES_UpdateByName(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTIMEZONES_UpdateByName";
			IDbDataParameter parMODIFIED_USER_ID      = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"     , "Guid",  16);
			IDbDataParameter parNAME                  = Sql.CreateParameter(cmd, "@NAME"                 , "string", 100);
			IDbDataParameter parSTANDARD_NAME         = Sql.CreateParameter(cmd, "@STANDARD_NAME"        , "string", 100);
			IDbDataParameter parSTANDARD_ABBREVIATION = Sql.CreateParameter(cmd, "@STANDARD_ABBREVIATION", "string",  10);
			IDbDataParameter parDAYLIGHT_NAME         = Sql.CreateParameter(cmd, "@DAYLIGHT_NAME"        , "string", 100);
			IDbDataParameter parDAYLIGHT_ABBREVIATION = Sql.CreateParameter(cmd, "@DAYLIGHT_ABBREVIATION", "string",  10);
			IDbDataParameter parBIAS                  = Sql.CreateParameter(cmd, "@BIAS"                 , "Int32",   4);
			IDbDataParameter parSTANDARD_BIAS         = Sql.CreateParameter(cmd, "@STANDARD_BIAS"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_BIAS         = Sql.CreateParameter(cmd, "@DAYLIGHT_BIAS"        , "Int32",   4);
			IDbDataParameter parSTANDARD_YEAR         = Sql.CreateParameter(cmd, "@STANDARD_YEAR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MONTH        = Sql.CreateParameter(cmd, "@STANDARD_MONTH"       , "Int32",   4);
			IDbDataParameter parSTANDARD_WEEK         = Sql.CreateParameter(cmd, "@STANDARD_WEEK"        , "Int32",   4);
			IDbDataParameter parSTANDARD_DAYOFWEEK    = Sql.CreateParameter(cmd, "@STANDARD_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parSTANDARD_HOUR         = Sql.CreateParameter(cmd, "@STANDARD_HOUR"        , "Int32",   4);
			IDbDataParameter parSTANDARD_MINUTE       = Sql.CreateParameter(cmd, "@STANDARD_MINUTE"      , "Int32",   4);
			IDbDataParameter parDAYLIGHT_YEAR         = Sql.CreateParameter(cmd, "@DAYLIGHT_YEAR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MONTH        = Sql.CreateParameter(cmd, "@DAYLIGHT_MONTH"       , "Int32",   4);
			IDbDataParameter parDAYLIGHT_WEEK         = Sql.CreateParameter(cmd, "@DAYLIGHT_WEEK"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_DAYOFWEEK    = Sql.CreateParameter(cmd, "@DAYLIGHT_DAYOFWEEK"   , "Int32",   4);
			IDbDataParameter parDAYLIGHT_HOUR         = Sql.CreateParameter(cmd, "@DAYLIGHT_HOUR"        , "Int32",   4);
			IDbDataParameter parDAYLIGHT_MINUTE       = Sql.CreateParameter(cmd, "@DAYLIGHT_MINUTE"      , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spTRACKER_Delete
		/// <summary>
		/// spTRACKER_Delete
		/// </summary>
		public static void spTRACKER_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTRACKER_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTRACKER_Delete
		/// <summary>
		/// spTRACKER_Delete
		/// </summary>
		public static void spTRACKER_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTRACKER_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTRACKER_Delete
		/// <summary>
		/// spTRACKER_Delete
		/// </summary>
		public static IDbCommand cmdTRACKER_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTRACKER_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spTRACKER_Update
		/// <summary>
		/// spTRACKER_Update
		/// </summary>
		public static void spTRACKER_Update(Guid gUSER_ID, string sMODULE_NAME, Guid gITEM_ID, string sITEM_SUMMARY)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spTRACKER_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
							IDbDataParameter parITEM_ID          = Sql.AddParameter(cmd, "@ITEM_ID"         , gITEM_ID           );
							IDbDataParameter parITEM_SUMMARY     = Sql.AddParameter(cmd, "@ITEM_SUMMARY"    , sITEM_SUMMARY      , 255);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spTRACKER_Update
		/// <summary>
		/// spTRACKER_Update
		/// </summary>
		public static void spTRACKER_Update(Guid gUSER_ID, string sMODULE_NAME, Guid gITEM_ID, string sITEM_SUMMARY, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spTRACKER_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parMODULE_NAME      = Sql.AddParameter(cmd, "@MODULE_NAME"     , sMODULE_NAME       ,  25);
				IDbDataParameter parITEM_ID          = Sql.AddParameter(cmd, "@ITEM_ID"         , gITEM_ID           );
				IDbDataParameter parITEM_SUMMARY     = Sql.AddParameter(cmd, "@ITEM_SUMMARY"    , sITEM_SUMMARY      , 255);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdTRACKER_Update
		/// <summary>
		/// spTRACKER_Update
		/// </summary>
		public static IDbCommand cmdTRACKER_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spTRACKER_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parMODULE_NAME      = Sql.CreateParameter(cmd, "@MODULE_NAME"     , "string",  25);
			IDbDataParameter parITEM_ID          = Sql.CreateParameter(cmd, "@ITEM_ID"         , "Guid",  16);
			IDbDataParameter parITEM_SUMMARY     = Sql.CreateParameter(cmd, "@ITEM_SUMMARY"    , "string", 255);
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_Delete
		/// <summary>
		/// spUSER_PREFERENCES_Delete
		/// </summary>
		public static void spUSER_PREFERENCES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSER_PREFERENCES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_Delete
		/// <summary>
		/// spUSER_PREFERENCES_Delete
		/// </summary>
		public static void spUSER_PREFERENCES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSER_PREFERENCES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_Delete
		/// <summary>
		/// spUSER_PREFERENCES_Delete
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSER_PREFERENCES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_DeleteByUser
		/// <summary>
		/// spUSER_PREFERENCES_DeleteByUser
		/// </summary>
		public static void spUSER_PREFERENCES_DeleteByUser(string sUSER_NAME, string sCATEGORY)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spUSER_PREFERENCES_DeleteByUse";
							else
								cmd.CommandText = "spUSER_PREFERENCES_DeleteByUser";
							IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_DeleteByUser
		/// <summary>
		/// spUSER_PREFERENCES_DeleteByUser
		/// </summary>
		public static void spUSER_PREFERENCES_DeleteByUser(string sUSER_NAME, string sCATEGORY, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spUSER_PREFERENCES_DeleteByUse";
				else
					cmd.CommandText = "spUSER_PREFERENCES_DeleteByUser";
				IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_DeleteByUser
		/// <summary>
		/// spUSER_PREFERENCES_DeleteByUser
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_DeleteByUser(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spUSER_PREFERENCES_DeleteByUse";
			else
				cmd.CommandText = "spUSER_PREFERENCES_DeleteByUser";
			IDbDataParameter parUSER_NAME        = Sql.CreateParameter(cmd, "@USER_NAME"       , "string",  20);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string", 255);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_InitPointer
		/// <summary>
		/// spUSER_PREFERENCES_InitPointer
		/// </summary>
		public static void spUSER_PREFERENCES_InitPointer(Guid gID, ref byte[] binFILE_POINTER)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSER_PREFERENCES_InitPointer";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							parFILE_POINTER.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_InitPointer
		/// <summary>
		/// spUSER_PREFERENCES_InitPointer
		/// </summary>
		public static void spUSER_PREFERENCES_InitPointer(Guid gID, ref byte[] binFILE_POINTER, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSER_PREFERENCES_InitPointer";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				parFILE_POINTER.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				binFILE_POINTER = Sql.ToBinary(parFILE_POINTER.Value);
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_InitPointer
		/// <summary>
		/// spUSER_PREFERENCES_InitPointer
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_InitPointer(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSER_PREFERENCES_InitPointer";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			parFILE_POINTER.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_Insert
		/// <summary>
		/// spUSER_PREFERENCES_Insert
		/// </summary>
		public static void spUSER_PREFERENCES_Insert(ref Guid gID, Guid gASSIGNED_USER_ID, string sCATEGORY)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSER_PREFERENCES_Insert";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_Insert
		/// <summary>
		/// spUSER_PREFERENCES_Insert
		/// </summary>
		public static void spUSER_PREFERENCES_Insert(ref Guid gID, Guid gASSIGNED_USER_ID, string sCATEGORY, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSER_PREFERENCES_Insert";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_Insert
		/// <summary>
		/// spUSER_PREFERENCES_Insert
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_Insert(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSER_PREFERENCES_Insert";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_InsertByUser
		/// <summary>
		/// spUSER_PREFERENCES_InsertByUser
		/// </summary>
		public static void spUSER_PREFERENCES_InsertByUser(ref Guid gID, string sUSER_NAME, string sCATEGORY)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spUSER_PREFERENCES_InsertByUse";
							else
								cmd.CommandText = "spUSER_PREFERENCES_InsertByUser";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
							IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_InsertByUser
		/// <summary>
		/// spUSER_PREFERENCES_InsertByUser
		/// </summary>
		public static void spUSER_PREFERENCES_InsertByUser(ref Guid gID, string sUSER_NAME, string sCATEGORY, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spUSER_PREFERENCES_InsertByUse";
				else
					cmd.CommandText = "spUSER_PREFERENCES_InsertByUser";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_NAME        = Sql.AddParameter(cmd, "@USER_NAME"       , sUSER_NAME         ,  20);
				IDbDataParameter parCATEGORY         = Sql.AddParameter(cmd, "@CATEGORY"        , sCATEGORY          , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_InsertByUser
		/// <summary>
		/// spUSER_PREFERENCES_InsertByUser
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_InsertByUser(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spUSER_PREFERENCES_InsertByUse";
			else
				cmd.CommandText = "spUSER_PREFERENCES_InsertByUser";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_NAME        = Sql.CreateParameter(cmd, "@USER_NAME"       , "string",  20);
			IDbDataParameter parCATEGORY         = Sql.CreateParameter(cmd, "@CATEGORY"        , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_ReadOffset
		/// <summary>
		/// spUSER_PREFERENCES_ReadOffset
		/// </summary>
		public static void spUSER_PREFERENCES_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSER_PREFERENCES_ReadOffset";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
							IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
							IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
							parBYTES.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							byBYTES = Sql.ToBinary(parBYTES.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_ReadOffset
		/// <summary>
		/// spUSER_PREFERENCES_ReadOffset
		/// </summary>
		public static void spUSER_PREFERENCES_ReadOffset(Guid gID, Int32 nFILE_OFFSET, Int32 nREAD_SIZE, ref byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSER_PREFERENCES_ReadOffset";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parFILE_OFFSET = Sql.AddParameter(cmd, "@FILE_OFFSET", nFILE_OFFSET  );
				IDbDataParameter parREAD_SIZE   = Sql.AddParameter(cmd, "@READ_SIZE"  , nREAD_SIZE    );
				IDbDataParameter parBYTES       = Sql.AddParameter(cmd, "@BYTES"      , byBYTES       );
				parBYTES.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				byBYTES = Sql.ToBinary(parBYTES.Value);
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_ReadOffset
		/// <summary>
		/// spUSER_PREFERENCES_ReadOffset
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_ReadOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSER_PREFERENCES_ReadOffset";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parFILE_OFFSET = Sql.CreateParameter(cmd, "@FILE_OFFSET", "Int32",   4);
			IDbDataParameter parREAD_SIZE   = Sql.CreateParameter(cmd, "@READ_SIZE"  , "Int32",   4);
			IDbDataParameter parBYTES       = Sql.CreateParameter(cmd, "@BYTES"      , "byte[]",  16);
			parBYTES.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSER_PREFERENCES_WriteOffset
		/// <summary>
		/// spUSER_PREFERENCES_WriteOffset
		/// </summary>
		public static void spUSER_PREFERENCES_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSER_PREFERENCES_WriteOffset";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
							IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSER_PREFERENCES_WriteOffset
		/// <summary>
		/// spUSER_PREFERENCES_WriteOffset
		/// </summary>
		public static void spUSER_PREFERENCES_WriteOffset(Guid gID, byte[] binFILE_POINTER, Int32 nFILE_OFFSET, byte[] byBYTES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSER_PREFERENCES_WriteOffset";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parFILE_POINTER     = Sql.AddParameter(cmd, "@FILE_POINTER"    , binFILE_POINTER    );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parFILE_OFFSET      = Sql.AddParameter(cmd, "@FILE_OFFSET"     , nFILE_OFFSET       );
				IDbDataParameter parBYTES            = Sql.AddParameter(cmd, "@BYTES"           , byBYTES            );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSER_PREFERENCES_WriteOffset
		/// <summary>
		/// spUSER_PREFERENCES_WriteOffset
		/// </summary>
		public static IDbCommand cmdUSER_PREFERENCES_WriteOffset(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSER_PREFERENCES_WriteOffset";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parFILE_POINTER     = Sql.CreateParameter(cmd, "@FILE_POINTER"    , "byte[]",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parFILE_OFFSET      = Sql.CreateParameter(cmd, "@FILE_OFFSET"     , "Int32",   4);
			IDbDataParameter parBYTES            = Sql.CreateParameter(cmd, "@BYTES"           , "byte[]",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_ACL_ROLES_MassUpdate
		/// <summary>
		/// spUSERS_ACL_ROLES_MassUpdate
		/// </summary>
		public static void spUSERS_ACL_ROLES_MassUpdate(Guid gUSER_ID, string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_ACL_ROLES_MassUpdate";
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_ACL_ROLES_MassUpdate
		/// <summary>
		/// spUSERS_ACL_ROLES_MassUpdate
		/// </summary>
		public static void spUSERS_ACL_ROLES_MassUpdate(Guid gUSER_ID, string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_ACL_ROLES_MassUpdate";
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_ACL_ROLES_MassUpdate
		/// <summary>
		/// spUSERS_ACL_ROLES_MassUpdate
		/// </summary>
		public static IDbCommand cmdUSERS_ACL_ROLES_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_ACL_ROLES_MassUpdate";
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			return cmd;
		}
		#endregion

		#region spUSERS_Delete
		/// <summary>
		/// spUSERS_Delete
		/// </summary>
		public static void spUSERS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_Delete
		/// <summary>
		/// spUSERS_Delete
		/// </summary>
		public static void spUSERS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_Delete
		/// <summary>
		/// spUSERS_Delete
		/// </summary>
		public static IDbCommand cmdUSERS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_FEEDS_Delete
		/// <summary>
		/// spUSERS_FEEDS_Delete
		/// </summary>
		public static void spUSERS_FEEDS_Delete(Guid gUSER_ID, Guid gFEED_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_FEEDS_Delete";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parFEED_ID          = Sql.AddParameter(cmd, "@FEED_ID"         , gFEED_ID           );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_FEEDS_Delete
		/// <summary>
		/// spUSERS_FEEDS_Delete
		/// </summary>
		public static void spUSERS_FEEDS_Delete(Guid gUSER_ID, Guid gFEED_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_FEEDS_Delete";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parFEED_ID          = Sql.AddParameter(cmd, "@FEED_ID"         , gFEED_ID           );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_FEEDS_Delete
		/// <summary>
		/// spUSERS_FEEDS_Delete
		/// </summary>
		public static IDbCommand cmdUSERS_FEEDS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_FEEDS_Delete";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parFEED_ID          = Sql.CreateParameter(cmd, "@FEED_ID"         , "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_FEEDS_Update
		/// <summary>
		/// spUSERS_FEEDS_Update
		/// </summary>
		public static void spUSERS_FEEDS_Update(Guid gUSER_ID, Guid gFEED_ID, Int32 nRANK)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_FEEDS_Update";
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parFEED_ID          = Sql.AddParameter(cmd, "@FEED_ID"         , gFEED_ID           );
							IDbDataParameter parRANK             = Sql.AddParameter(cmd, "@RANK"            , nRANK              );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_FEEDS_Update
		/// <summary>
		/// spUSERS_FEEDS_Update
		/// </summary>
		public static void spUSERS_FEEDS_Update(Guid gUSER_ID, Guid gFEED_ID, Int32 nRANK, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_FEEDS_Update";
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parFEED_ID          = Sql.AddParameter(cmd, "@FEED_ID"         , gFEED_ID           );
				IDbDataParameter parRANK             = Sql.AddParameter(cmd, "@RANK"            , nRANK              );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_FEEDS_Update
		/// <summary>
		/// spUSERS_FEEDS_Update
		/// </summary>
		public static IDbCommand cmdUSERS_FEEDS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_FEEDS_Update";
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parFEED_ID          = Sql.CreateParameter(cmd, "@FEED_ID"         , "Guid",  16);
			IDbDataParameter parRANK             = Sql.CreateParameter(cmd, "@RANK"            , "Int32",   4);
			return cmd;
		}
		#endregion

		#region spUSERS_InsertNTLM
		/// <summary>
		/// spUSERS_InsertNTLM
		/// </summary>
		public static void spUSERS_InsertNTLM(ref Guid gID, string sUSER_DOMAIN, string sUSER_NAME, bool bIS_ADMIN)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_InsertNTLM";
							IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
							IDbDataParameter parUSER_DOMAIN = Sql.AddParameter(cmd, "@USER_DOMAIN", sUSER_DOMAIN  ,  20);
							IDbDataParameter parUSER_NAME   = Sql.AddParameter(cmd, "@USER_NAME"  , sUSER_NAME    ,  20);
							IDbDataParameter parIS_ADMIN    = Sql.AddParameter(cmd, "@IS_ADMIN"   , bIS_ADMIN     );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_InsertNTLM
		/// <summary>
		/// spUSERS_InsertNTLM
		/// </summary>
		public static void spUSERS_InsertNTLM(ref Guid gID, string sUSER_DOMAIN, string sUSER_NAME, bool bIS_ADMIN, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_InsertNTLM";
				IDbDataParameter parID          = Sql.AddParameter(cmd, "@ID"         , gID           );
				IDbDataParameter parUSER_DOMAIN = Sql.AddParameter(cmd, "@USER_DOMAIN", sUSER_DOMAIN  ,  20);
				IDbDataParameter parUSER_NAME   = Sql.AddParameter(cmd, "@USER_NAME"  , sUSER_NAME    ,  20);
				IDbDataParameter parIS_ADMIN    = Sql.AddParameter(cmd, "@IS_ADMIN"   , bIS_ADMIN     );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSERS_InsertNTLM
		/// <summary>
		/// spUSERS_InsertNTLM
		/// </summary>
		public static IDbCommand cmdUSERS_InsertNTLM(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_InsertNTLM";
			IDbDataParameter parID          = Sql.CreateParameter(cmd, "@ID"         , "Guid",  16);
			IDbDataParameter parUSER_DOMAIN = Sql.CreateParameter(cmd, "@USER_DOMAIN", "string",  20);
			IDbDataParameter parUSER_NAME   = Sql.CreateParameter(cmd, "@USER_NAME"  , "string",  20);
			IDbDataParameter parIS_ADMIN    = Sql.CreateParameter(cmd, "@IS_ADMIN"   , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSERS_LAST_IMPORT_Delete
		/// <summary>
		/// spUSERS_LAST_IMPORT_Delete
		/// </summary>
		public static void spUSERS_LAST_IMPORT_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_LAST_IMPORT_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_LAST_IMPORT_Delete
		/// <summary>
		/// spUSERS_LAST_IMPORT_Delete
		/// </summary>
		public static void spUSERS_LAST_IMPORT_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_LAST_IMPORT_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_LAST_IMPORT_Delete
		/// <summary>
		/// spUSERS_LAST_IMPORT_Delete
		/// </summary>
		public static IDbCommand cmdUSERS_LAST_IMPORT_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_LAST_IMPORT_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_LAST_IMPORT_Update
		/// <summary>
		/// spUSERS_LAST_IMPORT_Update
		/// </summary>
		public static void spUSERS_LAST_IMPORT_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sBEAN_TYPE, Guid gBEAN_ID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_LAST_IMPORT_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
							IDbDataParameter parBEAN_TYPE        = Sql.AddParameter(cmd, "@BEAN_TYPE"       , sBEAN_TYPE         ,  25);
							IDbDataParameter parBEAN_ID          = Sql.AddParameter(cmd, "@BEAN_ID"         , gBEAN_ID           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_LAST_IMPORT_Update
		/// <summary>
		/// spUSERS_LAST_IMPORT_Update
		/// </summary>
		public static void spUSERS_LAST_IMPORT_Update(ref Guid gID, Guid gASSIGNED_USER_ID, string sBEAN_TYPE, Guid gBEAN_ID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_LAST_IMPORT_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parASSIGNED_USER_ID = Sql.AddParameter(cmd, "@ASSIGNED_USER_ID", gASSIGNED_USER_ID  );
				IDbDataParameter parBEAN_TYPE        = Sql.AddParameter(cmd, "@BEAN_TYPE"       , sBEAN_TYPE         ,  25);
				IDbDataParameter parBEAN_ID          = Sql.AddParameter(cmd, "@BEAN_ID"         , gBEAN_ID           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSERS_LAST_IMPORT_Update
		/// <summary>
		/// spUSERS_LAST_IMPORT_Update
		/// </summary>
		public static IDbCommand cmdUSERS_LAST_IMPORT_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_LAST_IMPORT_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parASSIGNED_USER_ID = Sql.CreateParameter(cmd, "@ASSIGNED_USER_ID", "Guid",  16);
			IDbDataParameter parBEAN_TYPE        = Sql.CreateParameter(cmd, "@BEAN_TYPE"       , "string",  25);
			IDbDataParameter parBEAN_ID          = Sql.CreateParameter(cmd, "@BEAN_ID"         , "Guid",  16);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSERS_MassDelete
		/// <summary>
		/// spUSERS_MassDelete
		/// </summary>
		public static void spUSERS_MassDelete(string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_MassDelete";
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_MassDelete
		/// <summary>
		/// spUSERS_MassDelete
		/// </summary>
		public static void spUSERS_MassDelete(string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_MassDelete";
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_MassDelete
		/// <summary>
		/// spUSERS_MassDelete
		/// </summary>
		public static IDbCommand cmdUSERS_MassDelete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_MassDelete";
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_PasswordUpdate
		/// <summary>
		/// spUSERS_PasswordUpdate
		/// </summary>
		public static void spUSERS_PasswordUpdate(Guid gID, string sUSER_HASH)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_PasswordUpdate";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_HASH        = Sql.AddParameter(cmd, "@USER_HASH"       , sUSER_HASH         ,  32);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_PasswordUpdate
		/// <summary>
		/// spUSERS_PasswordUpdate
		/// </summary>
		public static void spUSERS_PasswordUpdate(Guid gID, string sUSER_HASH, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_PasswordUpdate";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_HASH        = Sql.AddParameter(cmd, "@USER_HASH"       , sUSER_HASH         ,  32);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_PasswordUpdate
		/// <summary>
		/// spUSERS_PasswordUpdate
		/// </summary>
		public static IDbCommand cmdUSERS_PasswordUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_PasswordUpdate";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_HASH        = Sql.CreateParameter(cmd, "@USER_HASH"       , "string",  32);
			return cmd;
		}
		#endregion

		#region spUSERS_PreferencesUpdate
		/// <summary>
		/// spUSERS_PreferencesUpdate
		/// </summary>
		public static void spUSERS_PreferencesUpdate(Guid gID, string sUSER_PREFERENCES)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_PreferencesUpdate";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_PREFERENCES = Sql.AddParameter(cmd, "@USER_PREFERENCES", sUSER_PREFERENCES  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_PreferencesUpdate
		/// <summary>
		/// spUSERS_PreferencesUpdate
		/// </summary>
		public static void spUSERS_PreferencesUpdate(Guid gID, string sUSER_PREFERENCES, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_PreferencesUpdate";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_PREFERENCES = Sql.AddParameter(cmd, "@USER_PREFERENCES", sUSER_PREFERENCES  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_PreferencesUpdate
		/// <summary>
		/// spUSERS_PreferencesUpdate
		/// </summary>
		public static IDbCommand cmdUSERS_PreferencesUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_PreferencesUpdate";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_PREFERENCES = Sql.CreateParameter(cmd, "@USER_PREFERENCES", "string", 104857600);
			return cmd;
		}
		#endregion

		#region spUSERS_SIGNATURES_Delete
		/// <summary>
		/// spUSERS_SIGNATURES_Delete
		/// </summary>
		public static void spUSERS_SIGNATURES_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_SIGNATURES_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_SIGNATURES_Delete
		/// <summary>
		/// spUSERS_SIGNATURES_Delete
		/// </summary>
		public static void spUSERS_SIGNATURES_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_SIGNATURES_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_SIGNATURES_Delete
		/// <summary>
		/// spUSERS_SIGNATURES_Delete
		/// </summary>
		public static IDbCommand cmdUSERS_SIGNATURES_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_SIGNATURES_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spUSERS_SIGNATURES_Update
		/// <summary>
		/// spUSERS_SIGNATURES_Update
		/// </summary>
		public static void spUSERS_SIGNATURES_Update(ref Guid gID, Guid gUSER_ID, string sNAME, string sSIGNATURE, string sSIGNATURE_HTML)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_SIGNATURES_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parSIGNATURE        = Sql.AddParameter(cmd, "@SIGNATURE"       , sSIGNATURE         );
							IDbDataParameter parSIGNATURE_HTML   = Sql.AddParameter(cmd, "@SIGNATURE_HTML"  , sSIGNATURE_HTML    );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_SIGNATURES_Update
		/// <summary>
		/// spUSERS_SIGNATURES_Update
		/// </summary>
		public static void spUSERS_SIGNATURES_Update(ref Guid gID, Guid gUSER_ID, string sNAME, string sSIGNATURE, string sSIGNATURE_HTML, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_SIGNATURES_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parSIGNATURE        = Sql.AddParameter(cmd, "@SIGNATURE"       , sSIGNATURE         );
				IDbDataParameter parSIGNATURE_HTML   = Sql.AddParameter(cmd, "@SIGNATURE_HTML"  , sSIGNATURE_HTML    );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSERS_SIGNATURES_Update
		/// <summary>
		/// spUSERS_SIGNATURES_Update
		/// </summary>
		public static IDbCommand cmdUSERS_SIGNATURES_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_SIGNATURES_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parSIGNATURE        = Sql.CreateParameter(cmd, "@SIGNATURE"       , "string", 104857600);
			IDbDataParameter parSIGNATURE_HTML   = Sql.CreateParameter(cmd, "@SIGNATURE_HTML"  , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static void spUSERS_TEAM_MEMBERSHIPS_MassUpdate(Guid gUSER_ID, string sID_LIST)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							if ( Sql.IsOracle(cmd) )
								cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassU";
							else
								cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassUpdate";
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static void spUSERS_TEAM_MEMBERSHIPS_MassUpdate(Guid gUSER_ID, string sID_LIST, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				if ( Sql.IsOracle(cmd) )
					cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassU";
				else
					cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassUpdate";
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parID_LIST          = Sql.AddAnsiParam(cmd, "@ID_LIST"         , sID_LIST           , 8000);
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// <summary>
		/// spUSERS_TEAM_MEMBERSHIPS_MassUpdate
		/// </summary>
		public static IDbCommand cmdUSERS_TEAM_MEMBERSHIPS_MassUpdate(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			if ( Sql.IsOracle(cmd) )
				cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassU";
			else
				cmd.CommandText = "spUSERS_TEAM_MEMBERSHIPS_MassUpdate";
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parID_LIST          = Sql.CreateParameter(cmd, "@ID_LIST"         , "ansistring", 8000);
			return cmd;
		}
		#endregion

		#region spUSERS_Update
		/// <summary>
		/// spUSERS_Update
		/// </summary>
		public static void spUSERS_Update(ref Guid gID, string sUSER_NAME, string sFIRST_NAME, string sLAST_NAME, Guid gREPORTS_TO_ID, bool bIS_ADMIN, bool bRECEIVE_NOTIFICATIONS, string sDESCRIPTION, string sTITLE, string sDEPARTMENT, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sSTATUS, string sADDRESS_STREET, string sADDRESS_CITY, string sADDRESS_STATE, string sADDRESS_POSTALCODE, string sADDRESS_COUNTRY, string sUSER_PREFERENCES, bool bPORTAL_ONLY, string sEMPLOYEE_STATUS, string sMESSENGER_ID, string sMESSENGER_TYPE, string sPARENT_TYPE, Guid gPARENT_ID, bool bIS_GROUP)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spUSERS_Update";
							IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
							IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
							IDbDataParameter parUSER_NAME             = Sql.AddParameter(cmd, "@USER_NAME"            , sUSER_NAME              ,  20);
							IDbDataParameter parFIRST_NAME            = Sql.AddParameter(cmd, "@FIRST_NAME"           , sFIRST_NAME             ,  30);
							IDbDataParameter parLAST_NAME             = Sql.AddParameter(cmd, "@LAST_NAME"            , sLAST_NAME              ,  30);
							IDbDataParameter parREPORTS_TO_ID         = Sql.AddParameter(cmd, "@REPORTS_TO_ID"        , gREPORTS_TO_ID          );
							IDbDataParameter parIS_ADMIN              = Sql.AddParameter(cmd, "@IS_ADMIN"             , bIS_ADMIN               );
							IDbDataParameter parRECEIVE_NOTIFICATIONS = Sql.AddParameter(cmd, "@RECEIVE_NOTIFICATIONS", bRECEIVE_NOTIFICATIONS  );
							IDbDataParameter parDESCRIPTION           = Sql.AddParameter(cmd, "@DESCRIPTION"          , sDESCRIPTION            );
							IDbDataParameter parTITLE                 = Sql.AddParameter(cmd, "@TITLE"                , sTITLE                  ,  50);
							IDbDataParameter parDEPARTMENT            = Sql.AddParameter(cmd, "@DEPARTMENT"           , sDEPARTMENT             ,  50);
							IDbDataParameter parPHONE_HOME            = Sql.AddParameter(cmd, "@PHONE_HOME"           , sPHONE_HOME             ,  50);
							IDbDataParameter parPHONE_MOBILE          = Sql.AddParameter(cmd, "@PHONE_MOBILE"         , sPHONE_MOBILE           ,  50);
							IDbDataParameter parPHONE_WORK            = Sql.AddParameter(cmd, "@PHONE_WORK"           , sPHONE_WORK             ,  50);
							IDbDataParameter parPHONE_OTHER           = Sql.AddParameter(cmd, "@PHONE_OTHER"          , sPHONE_OTHER            ,  50);
							IDbDataParameter parPHONE_FAX             = Sql.AddParameter(cmd, "@PHONE_FAX"            , sPHONE_FAX              ,  50);
							IDbDataParameter parEMAIL1                = Sql.AddParameter(cmd, "@EMAIL1"               , sEMAIL1                 , 100);
							IDbDataParameter parEMAIL2                = Sql.AddParameter(cmd, "@EMAIL2"               , sEMAIL2                 , 100);
							IDbDataParameter parSTATUS                = Sql.AddParameter(cmd, "@STATUS"               , sSTATUS                 ,  25);
							IDbDataParameter parADDRESS_STREET        = Sql.AddParameter(cmd, "@ADDRESS_STREET"       , sADDRESS_STREET         , 150);
							IDbDataParameter parADDRESS_CITY          = Sql.AddParameter(cmd, "@ADDRESS_CITY"         , sADDRESS_CITY           , 100);
							IDbDataParameter parADDRESS_STATE         = Sql.AddParameter(cmd, "@ADDRESS_STATE"        , sADDRESS_STATE          , 100);
							IDbDataParameter parADDRESS_POSTALCODE    = Sql.AddParameter(cmd, "@ADDRESS_POSTALCODE"   , sADDRESS_POSTALCODE     ,   9);
							IDbDataParameter parADDRESS_COUNTRY       = Sql.AddParameter(cmd, "@ADDRESS_COUNTRY"      , sADDRESS_COUNTRY        ,  25);
							IDbDataParameter parUSER_PREFERENCES      = Sql.AddParameter(cmd, "@USER_PREFERENCES"     , sUSER_PREFERENCES       );
							IDbDataParameter parPORTAL_ONLY           = Sql.AddParameter(cmd, "@PORTAL_ONLY"          , bPORTAL_ONLY            );
							IDbDataParameter parEMPLOYEE_STATUS       = Sql.AddParameter(cmd, "@EMPLOYEE_STATUS"      , sEMPLOYEE_STATUS        ,  25);
							IDbDataParameter parMESSENGER_ID          = Sql.AddParameter(cmd, "@MESSENGER_ID"         , sMESSENGER_ID           ,  25);
							IDbDataParameter parMESSENGER_TYPE        = Sql.AddParameter(cmd, "@MESSENGER_TYPE"       , sMESSENGER_TYPE         ,  25);
							IDbDataParameter parPARENT_TYPE           = Sql.AddParameter(cmd, "@PARENT_TYPE"          , sPARENT_TYPE            ,  25);
							IDbDataParameter parPARENT_ID             = Sql.AddParameter(cmd, "@PARENT_ID"            , gPARENT_ID              );
							IDbDataParameter parIS_GROUP              = Sql.AddParameter(cmd, "@IS_GROUP"             , bIS_GROUP               );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spUSERS_Update
		/// <summary>
		/// spUSERS_Update
		/// </summary>
		public static void spUSERS_Update(ref Guid gID, string sUSER_NAME, string sFIRST_NAME, string sLAST_NAME, Guid gREPORTS_TO_ID, bool bIS_ADMIN, bool bRECEIVE_NOTIFICATIONS, string sDESCRIPTION, string sTITLE, string sDEPARTMENT, string sPHONE_HOME, string sPHONE_MOBILE, string sPHONE_WORK, string sPHONE_OTHER, string sPHONE_FAX, string sEMAIL1, string sEMAIL2, string sSTATUS, string sADDRESS_STREET, string sADDRESS_CITY, string sADDRESS_STATE, string sADDRESS_POSTALCODE, string sADDRESS_COUNTRY, string sUSER_PREFERENCES, bool bPORTAL_ONLY, string sEMPLOYEE_STATUS, string sMESSENGER_ID, string sMESSENGER_TYPE, string sPARENT_TYPE, Guid gPARENT_ID, bool bIS_GROUP, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spUSERS_Update";
				IDbDataParameter parID                    = Sql.AddParameter(cmd, "@ID"                   , gID                     );
				IDbDataParameter parMODIFIED_USER_ID      = Sql.AddParameter(cmd, "@MODIFIED_USER_ID"     ,  Security.USER_ID       );
				IDbDataParameter parUSER_NAME             = Sql.AddParameter(cmd, "@USER_NAME"            , sUSER_NAME              ,  20);
				IDbDataParameter parFIRST_NAME            = Sql.AddParameter(cmd, "@FIRST_NAME"           , sFIRST_NAME             ,  30);
				IDbDataParameter parLAST_NAME             = Sql.AddParameter(cmd, "@LAST_NAME"            , sLAST_NAME              ,  30);
				IDbDataParameter parREPORTS_TO_ID         = Sql.AddParameter(cmd, "@REPORTS_TO_ID"        , gREPORTS_TO_ID          );
				IDbDataParameter parIS_ADMIN              = Sql.AddParameter(cmd, "@IS_ADMIN"             , bIS_ADMIN               );
				IDbDataParameter parRECEIVE_NOTIFICATIONS = Sql.AddParameter(cmd, "@RECEIVE_NOTIFICATIONS", bRECEIVE_NOTIFICATIONS  );
				IDbDataParameter parDESCRIPTION           = Sql.AddParameter(cmd, "@DESCRIPTION"          , sDESCRIPTION            );
				IDbDataParameter parTITLE                 = Sql.AddParameter(cmd, "@TITLE"                , sTITLE                  ,  50);
				IDbDataParameter parDEPARTMENT            = Sql.AddParameter(cmd, "@DEPARTMENT"           , sDEPARTMENT             ,  50);
				IDbDataParameter parPHONE_HOME            = Sql.AddParameter(cmd, "@PHONE_HOME"           , sPHONE_HOME             ,  50);
				IDbDataParameter parPHONE_MOBILE          = Sql.AddParameter(cmd, "@PHONE_MOBILE"         , sPHONE_MOBILE           ,  50);
				IDbDataParameter parPHONE_WORK            = Sql.AddParameter(cmd, "@PHONE_WORK"           , sPHONE_WORK             ,  50);
				IDbDataParameter parPHONE_OTHER           = Sql.AddParameter(cmd, "@PHONE_OTHER"          , sPHONE_OTHER            ,  50);
				IDbDataParameter parPHONE_FAX             = Sql.AddParameter(cmd, "@PHONE_FAX"            , sPHONE_FAX              ,  50);
				IDbDataParameter parEMAIL1                = Sql.AddParameter(cmd, "@EMAIL1"               , sEMAIL1                 , 100);
				IDbDataParameter parEMAIL2                = Sql.AddParameter(cmd, "@EMAIL2"               , sEMAIL2                 , 100);
				IDbDataParameter parSTATUS                = Sql.AddParameter(cmd, "@STATUS"               , sSTATUS                 ,  25);
				IDbDataParameter parADDRESS_STREET        = Sql.AddParameter(cmd, "@ADDRESS_STREET"       , sADDRESS_STREET         , 150);
				IDbDataParameter parADDRESS_CITY          = Sql.AddParameter(cmd, "@ADDRESS_CITY"         , sADDRESS_CITY           , 100);
				IDbDataParameter parADDRESS_STATE         = Sql.AddParameter(cmd, "@ADDRESS_STATE"        , sADDRESS_STATE          , 100);
				IDbDataParameter parADDRESS_POSTALCODE    = Sql.AddParameter(cmd, "@ADDRESS_POSTALCODE"   , sADDRESS_POSTALCODE     ,   9);
				IDbDataParameter parADDRESS_COUNTRY       = Sql.AddParameter(cmd, "@ADDRESS_COUNTRY"      , sADDRESS_COUNTRY        ,  25);
				IDbDataParameter parUSER_PREFERENCES      = Sql.AddParameter(cmd, "@USER_PREFERENCES"     , sUSER_PREFERENCES       );
				IDbDataParameter parPORTAL_ONLY           = Sql.AddParameter(cmd, "@PORTAL_ONLY"          , bPORTAL_ONLY            );
				IDbDataParameter parEMPLOYEE_STATUS       = Sql.AddParameter(cmd, "@EMPLOYEE_STATUS"      , sEMPLOYEE_STATUS        ,  25);
				IDbDataParameter parMESSENGER_ID          = Sql.AddParameter(cmd, "@MESSENGER_ID"         , sMESSENGER_ID           ,  25);
				IDbDataParameter parMESSENGER_TYPE        = Sql.AddParameter(cmd, "@MESSENGER_TYPE"       , sMESSENGER_TYPE         ,  25);
				IDbDataParameter parPARENT_TYPE           = Sql.AddParameter(cmd, "@PARENT_TYPE"          , sPARENT_TYPE            ,  25);
				IDbDataParameter parPARENT_ID             = Sql.AddParameter(cmd, "@PARENT_ID"            , gPARENT_ID              );
				IDbDataParameter parIS_GROUP              = Sql.AddParameter(cmd, "@IS_GROUP"             , bIS_GROUP               );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdUSERS_Update
		/// <summary>
		/// spUSERS_Update
		/// </summary>
		public static IDbCommand cmdUSERS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spUSERS_Update";
			IDbDataParameter parID                    = Sql.CreateParameter(cmd, "@ID"                   , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID      = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID"     , "Guid",  16);
			IDbDataParameter parUSER_NAME             = Sql.CreateParameter(cmd, "@USER_NAME"            , "string",  20);
			IDbDataParameter parFIRST_NAME            = Sql.CreateParameter(cmd, "@FIRST_NAME"           , "string",  30);
			IDbDataParameter parLAST_NAME             = Sql.CreateParameter(cmd, "@LAST_NAME"            , "string",  30);
			IDbDataParameter parREPORTS_TO_ID         = Sql.CreateParameter(cmd, "@REPORTS_TO_ID"        , "Guid",  16);
			IDbDataParameter parIS_ADMIN              = Sql.CreateParameter(cmd, "@IS_ADMIN"             , "bool",   1);
			IDbDataParameter parRECEIVE_NOTIFICATIONS = Sql.CreateParameter(cmd, "@RECEIVE_NOTIFICATIONS", "bool",   1);
			IDbDataParameter parDESCRIPTION           = Sql.CreateParameter(cmd, "@DESCRIPTION"          , "string", 104857600);
			IDbDataParameter parTITLE                 = Sql.CreateParameter(cmd, "@TITLE"                , "string",  50);
			IDbDataParameter parDEPARTMENT            = Sql.CreateParameter(cmd, "@DEPARTMENT"           , "string",  50);
			IDbDataParameter parPHONE_HOME            = Sql.CreateParameter(cmd, "@PHONE_HOME"           , "string",  50);
			IDbDataParameter parPHONE_MOBILE          = Sql.CreateParameter(cmd, "@PHONE_MOBILE"         , "string",  50);
			IDbDataParameter parPHONE_WORK            = Sql.CreateParameter(cmd, "@PHONE_WORK"           , "string",  50);
			IDbDataParameter parPHONE_OTHER           = Sql.CreateParameter(cmd, "@PHONE_OTHER"          , "string",  50);
			IDbDataParameter parPHONE_FAX             = Sql.CreateParameter(cmd, "@PHONE_FAX"            , "string",  50);
			IDbDataParameter parEMAIL1                = Sql.CreateParameter(cmd, "@EMAIL1"               , "string", 100);
			IDbDataParameter parEMAIL2                = Sql.CreateParameter(cmd, "@EMAIL2"               , "string", 100);
			IDbDataParameter parSTATUS                = Sql.CreateParameter(cmd, "@STATUS"               , "string",  25);
			IDbDataParameter parADDRESS_STREET        = Sql.CreateParameter(cmd, "@ADDRESS_STREET"       , "string", 150);
			IDbDataParameter parADDRESS_CITY          = Sql.CreateParameter(cmd, "@ADDRESS_CITY"         , "string", 100);
			IDbDataParameter parADDRESS_STATE         = Sql.CreateParameter(cmd, "@ADDRESS_STATE"        , "string", 100);
			IDbDataParameter parADDRESS_POSTALCODE    = Sql.CreateParameter(cmd, "@ADDRESS_POSTALCODE"   , "string",   9);
			IDbDataParameter parADDRESS_COUNTRY       = Sql.CreateParameter(cmd, "@ADDRESS_COUNTRY"      , "string",  25);
			IDbDataParameter parUSER_PREFERENCES      = Sql.CreateParameter(cmd, "@USER_PREFERENCES"     , "string", 104857600);
			IDbDataParameter parPORTAL_ONLY           = Sql.CreateParameter(cmd, "@PORTAL_ONLY"          , "bool",   1);
			IDbDataParameter parEMPLOYEE_STATUS       = Sql.CreateParameter(cmd, "@EMPLOYEE_STATUS"      , "string",  25);
			IDbDataParameter parMESSENGER_ID          = Sql.CreateParameter(cmd, "@MESSENGER_ID"         , "string",  25);
			IDbDataParameter parMESSENGER_TYPE        = Sql.CreateParameter(cmd, "@MESSENGER_TYPE"       , "string",  25);
			IDbDataParameter parPARENT_TYPE           = Sql.CreateParameter(cmd, "@PARENT_TYPE"          , "string",  25);
			IDbDataParameter parPARENT_ID             = Sql.CreateParameter(cmd, "@PARENT_ID"            , "Guid",  16);
			IDbDataParameter parIS_GROUP              = Sql.CreateParameter(cmd, "@IS_GROUP"             , "bool",   1);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spVCALS_Delete
		/// <summary>
		/// spVCALS_Delete
		/// </summary>
		public static void spVCALS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spVCALS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spVCALS_Delete
		/// <summary>
		/// spVCALS_Delete
		/// </summary>
		public static void spVCALS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spVCALS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdVCALS_Delete
		/// <summary>
		/// spVCALS_Delete
		/// </summary>
		public static IDbCommand cmdVCALS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spVCALS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spVCALS_Update
		/// <summary>
		/// spVCALS_Update
		/// </summary>
		public static void spVCALS_Update(ref Guid gID, Guid gUSER_ID, string sTYPE, string sSOURCE, string sCONTENT)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spVCALS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
							IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
							IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            ,  25);
							IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spVCALS_Update
		/// <summary>
		/// spVCALS_Update
		/// </summary>
		public static void spVCALS_Update(ref Guid gID, Guid gUSER_ID, string sTYPE, string sSOURCE, string sCONTENT, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spVCALS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parUSER_ID          = Sql.AddParameter(cmd, "@USER_ID"         , gUSER_ID           );
				IDbDataParameter parTYPE             = Sql.AddParameter(cmd, "@TYPE"            , sTYPE              ,  25);
				IDbDataParameter parSOURCE           = Sql.AddParameter(cmd, "@SOURCE"          , sSOURCE            ,  25);
				IDbDataParameter parCONTENT          = Sql.AddParameter(cmd, "@CONTENT"         , sCONTENT           );
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdVCALS_Update
		/// <summary>
		/// spVCALS_Update
		/// </summary>
		public static IDbCommand cmdVCALS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spVCALS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parUSER_ID          = Sql.CreateParameter(cmd, "@USER_ID"         , "Guid",  16);
			IDbDataParameter parTYPE             = Sql.CreateParameter(cmd, "@TYPE"            , "string",  25);
			IDbDataParameter parSOURCE           = Sql.CreateParameter(cmd, "@SOURCE"          , "string",  25);
			IDbDataParameter parCONTENT          = Sql.CreateParameter(cmd, "@CONTENT"         , "string", 104857600);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spVERSIONS_Delete
		/// <summary>
		/// spVERSIONS_Delete
		/// </summary>
		public static void spVERSIONS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spVERSIONS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spVERSIONS_Delete
		/// <summary>
		/// spVERSIONS_Delete
		/// </summary>
		public static void spVERSIONS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spVERSIONS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdVERSIONS_Delete
		/// <summary>
		/// spVERSIONS_Delete
		/// </summary>
		public static IDbCommand cmdVERSIONS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spVERSIONS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spVERSIONS_Update
		/// <summary>
		/// spVERSIONS_Update
		/// </summary>
		public static void spVERSIONS_Update(ref Guid gID, string sNAME, string sFILE_VERSION, string sDB_VERSION)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spVERSIONS_Update";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
							IDbDataParameter parFILE_VERSION     = Sql.AddParameter(cmd, "@FILE_VERSION"    , sFILE_VERSION      , 255);
							IDbDataParameter parDB_VERSION       = Sql.AddParameter(cmd, "@DB_VERSION"      , sDB_VERSION        , 255);
							parID.Direction = ParameterDirection.InputOutput;
							cmd.ExecuteNonQuery();
							gID = Sql.ToGuid(parID.Value);
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spVERSIONS_Update
		/// <summary>
		/// spVERSIONS_Update
		/// </summary>
		public static void spVERSIONS_Update(ref Guid gID, string sNAME, string sFILE_VERSION, string sDB_VERSION, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spVERSIONS_Update";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				IDbDataParameter parNAME             = Sql.AddParameter(cmd, "@NAME"            , sNAME              , 255);
				IDbDataParameter parFILE_VERSION     = Sql.AddParameter(cmd, "@FILE_VERSION"    , sFILE_VERSION      , 255);
				IDbDataParameter parDB_VERSION       = Sql.AddParameter(cmd, "@DB_VERSION"      , sDB_VERSION        , 255);
				parID.Direction = ParameterDirection.InputOutput;
				cmd.ExecuteNonQuery();
				gID = Sql.ToGuid(parID.Value);
			}
		}
		#endregion

		#region cmdVERSIONS_Update
		/// <summary>
		/// spVERSIONS_Update
		/// </summary>
		public static IDbCommand cmdVERSIONS_Update(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spVERSIONS_Update";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			IDbDataParameter parNAME             = Sql.CreateParameter(cmd, "@NAME"            , "string", 255);
			IDbDataParameter parFILE_VERSION     = Sql.CreateParameter(cmd, "@FILE_VERSION"    , "string", 255);
			IDbDataParameter parDB_VERSION       = Sql.CreateParameter(cmd, "@DB_VERSION"      , "string", 255);
			parID.Direction = ParameterDirection.InputOutput;
			return cmd;
		}
		#endregion

		#region spWORKFLOW_EVENTS_Delete
		/// <summary>
		/// spWORKFLOW_EVENTS_Delete
		/// </summary>
		public static void spWORKFLOW_EVENTS_Delete(Guid gID)
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spWORKFLOW_EVENTS_Delete";
							IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
							IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spWORKFLOW_EVENTS_Delete
		/// <summary>
		/// spWORKFLOW_EVENTS_Delete
		/// </summary>
		public static void spWORKFLOW_EVENTS_Delete(Guid gID, IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spWORKFLOW_EVENTS_Delete";
				IDbDataParameter parID               = Sql.AddParameter(cmd, "@ID"              , gID                );
				IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID",  Security.USER_ID  );
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdWORKFLOW_EVENTS_Delete
		/// <summary>
		/// spWORKFLOW_EVENTS_Delete
		/// </summary>
		public static IDbCommand cmdWORKFLOW_EVENTS_Delete(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spWORKFLOW_EVENTS_Delete";
			IDbDataParameter parID               = Sql.CreateParameter(cmd, "@ID"              , "Guid",  16);
			IDbDataParameter parMODIFIED_USER_ID = Sql.CreateParameter(cmd, "@MODIFIED_USER_ID", "Guid",  16);
			return cmd;
		}
		#endregion

		#region spWORKFLOW_EVENTS_ProcessAll
		/// <summary>
		/// spWORKFLOW_EVENTS_ProcessAll
		/// </summary>
		public static void spWORKFLOW_EVENTS_ProcessAll()
		{
			DbProviderFactory dbf = DbProviderFactories.GetFactory();
			using ( IDbConnection con = dbf.CreateConnection() )
			{
				con.Open();
				using ( IDbTransaction trn = con.BeginTransaction() )
				{
					try
					{
						using ( IDbCommand cmd = con.CreateCommand() )
						{
							cmd.Transaction = trn;
							cmd.CommandType = CommandType.StoredProcedure;
							cmd.CommandText = "spWORKFLOW_EVENTS_ProcessAll";
							cmd.ExecuteNonQuery();
						}
						trn.Commit();
					}
					catch(Exception ex)
					{
						trn.Rollback();
						throw(new Exception(ex.Message, ex.InnerException));
					}
				}
			}
		}
		#endregion

		#region spWORKFLOW_EVENTS_ProcessAll
		/// <summary>
		/// spWORKFLOW_EVENTS_ProcessAll
		/// </summary>
		public static void spWORKFLOW_EVENTS_ProcessAll(IDbTransaction trn)
		{
			IDbConnection con = trn.Connection;
			using ( IDbCommand cmd = con.CreateCommand() )
			{
				cmd.Transaction = trn;
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.CommandText = "spWORKFLOW_EVENTS_ProcessAll";
				cmd.ExecuteNonQuery();
			}
		}
		#endregion

		#region cmdWORKFLOW_EVENTS_ProcessAll
		/// <summary>
		/// spWORKFLOW_EVENTS_ProcessAll
		/// </summary>
		public static IDbCommand cmdWORKFLOW_EVENTS_ProcessAll(IDbConnection con)
		{
			IDbCommand cmd = con.CreateCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "spWORKFLOW_EVENTS_ProcessAll";
			return cmd;
		}
		#endregion

		#region Factory
		/// <summary>
		/// Factory
		/// </summary>
		public static IDbCommand Factory(IDbConnection con, string sProcedureName)
		{
			IDbCommand cmd = null;
			switch ( sProcedureName.ToUpper() )
			{
				case "SPACCOUNTS_BUGS_DELETE"                :  cmd = cmdACCOUNTS_BUGS_Delete                (con);  break;
				case "SPACCOUNTS_BUGS_UPDATE"                :  cmd = cmdACCOUNTS_BUGS_Update                (con);  break;
				case "SPACCOUNTS_CASES_DELETE"               :  cmd = cmdACCOUNTS_CASES_Delete               (con);  break;
				case "SPACCOUNTS_CASES_UPDATE"               :  cmd = cmdACCOUNTS_CASES_Update               (con);  break;
				case "SPACCOUNTS_CONTACTS_DELETE"            :  cmd = cmdACCOUNTS_CONTACTS_Delete            (con);  break;
				case "SPACCOUNTS_CONTACTS_UPDATE"            :  cmd = cmdACCOUNTS_CONTACTS_Update            (con);  break;
				case "SPACCOUNTS_DELETE"                     :  cmd = cmdACCOUNTS_Delete                     (con);  break;
				case "SPACCOUNTS_MASSDELETE"                 :  cmd = cmdACCOUNTS_MassDelete                 (con);  break;
				case "SPACCOUNTS_MASSUPDATE"                 :  cmd = cmdACCOUNTS_MassUpdate                 (con);  break;
				case "SPACCOUNTS_NEW"                        :  cmd = cmdACCOUNTS_New                        (con);  break;
				case "SPACCOUNTS_OPPORTUNITIES_DELETE"       :  cmd = cmdACCOUNTS_OPPORTUNITIES_Delete       (con);  break;
				case "SPACCOUNTS_OPPORTUNITIES_UPDATE"       :  cmd = cmdACCOUNTS_OPPORTUNITIES_Update       (con);  break;
				case "SPACCOUNTS_PARENT_UPDATE"              :  cmd = cmdACCOUNTS_PARENT_Update              (con);  break;
				case "SPACCOUNTS_QUOTES_DELETE"              :  cmd = cmdACCOUNTS_QUOTES_Delete              (con);  break;
				case "SPACCOUNTS_THREADS_DELETE"             :  cmd = cmdACCOUNTS_THREADS_Delete             (con);  break;
				case "SPACCOUNTS_THREADS_UPDATE"             :  cmd = cmdACCOUNTS_THREADS_Update             (con);  break;
				case "SPACCOUNTS_UPDATE"                     :  cmd = cmdACCOUNTS_Update                     (con);  break;
				case "SPACL_ACTIONS_DELETE"                  :  cmd = cmdACL_ACTIONS_Delete                  (con);  break;
				case "SPACL_ACTIONS_INITIALIZE"              :  cmd = cmdACL_ACTIONS_Initialize              (con);  break;
				case "SPACL_ACTIONS_INSERTONLY"              :  cmd = cmdACL_ACTIONS_InsertOnly              (con);  break;
				case "SPACL_ACTIONS_UPDATE"                  :  cmd = cmdACL_ACTIONS_Update                  (con);  break;
				case "SPACL_ROLES_ACTIONS_DELETE"            :  cmd = cmdACL_ROLES_ACTIONS_Delete            (con);  break;
				case "SPACL_ROLES_ACTIONS_UPDATE"            :  cmd = cmdACL_ROLES_ACTIONS_Update            (con);  break;
				case "SPACL_ROLES_DELETE"                    :  cmd = cmdACL_ROLES_Delete                    (con);  break;
				case "SPACL_ROLES_MASSDELETE"                :  cmd = cmdACL_ROLES_MassDelete                (con);  break;
				case "SPACL_ROLES_UPDATE"                    :  cmd = cmdACL_ROLES_Update                    (con);  break;
				case "SPACL_ROLES_USERS_DELETE"              :  cmd = cmdACL_ROLES_USERS_Delete              (con);  break;
				case "SPACL_ROLES_USERS_MASSUPDATE"          :  cmd = cmdACL_ROLES_USERS_MassUpdate          (con);  break;
				case "SPACL_ROLES_USERS_UPDATE"              :  cmd = cmdACL_ROLES_USERS_Update              (con);  break;
				case "SPACTIVITIES_DELETE"                   :  cmd = cmdACTIVITIES_Delete                   (con);  break;
				case "SPACTIVITIES_UPDATESTATUS"             :  cmd = cmdACTIVITIES_UpdateStatus             (con);  break;
				case "SPAUDITING_DISABLE"                    :  cmd = cmdAuditing_Disable                    (con);  break;
				case "SPAUDITING_ENABLE"                     :  cmd = cmdAuditing_Enable                     (con);  break;
				case "SPBUG_ATTACHMENTS_DELETE"              :  cmd = cmdBUG_ATTACHMENTS_Delete              (con);  break;
				case "SPBUG_ATTACHMENTS_INSERT"              :  cmd = cmdBUG_ATTACHMENTS_Insert              (con);  break;
				case "SPBUGS_ATTACHMENT_INITPOINTER"         :  cmd = cmdBUGS_ATTACHMENT_InitPointer         (con);  break;
				case "SPBUGS_ATTACHMENT_READOFFSET"          :  cmd = cmdBUGS_ATTACHMENT_ReadOffset          (con);  break;
				case "SPBUGS_ATTACHMENT_WRITEOFFSET"         :  cmd = cmdBUGS_ATTACHMENT_WriteOffset         (con);  break;
				case "SPBUGS_DELETE"                         :  cmd = cmdBUGS_Delete                         (con);  break;
				case "SPBUGS_MASSDELETE"                     :  cmd = cmdBUGS_MassDelete                     (con);  break;
				case "SPBUGS_MASSUPDATE"                     :  cmd = cmdBUGS_MassUpdate                     (con);  break;
				case "SPBUGS_NEW"                            :  cmd = cmdBUGS_New                            (con);  break;
				case "SPBUGS_THREADS_DELETE"                 :  cmd = cmdBUGS_THREADS_Delete                 (con);  break;
				case "SPBUGS_THREADS_UPDATE"                 :  cmd = cmdBUGS_THREADS_Update                 (con);  break;
				case "SPBUGS_UPDATE"                         :  cmd = cmdBUGS_Update                         (con);  break;
				case "SPCALLS_CONTACTS_DELETE"               :  cmd = cmdCALLS_CONTACTS_Delete               (con);  break;
				case "SPCALLS_CONTACTS_UPDATE"               :  cmd = cmdCALLS_CONTACTS_Update               (con);  break;
				case "SPCALLS_DELETE"                        :  cmd = cmdCALLS_Delete                        (con);  break;
				case "SPCALLS_INVITEEMASSUPDATE"             :  cmd = cmdCALLS_InviteeMassUpdate             (con);  break;
				case "SPCALLS_MASSDELETE"                    :  cmd = cmdCALLS_MassDelete                    (con);  break;
				case "SPCALLS_MASSUPDATE"                    :  cmd = cmdCALLS_MassUpdate                    (con);  break;
				case "SPCALLS_NEW"                           :  cmd = cmdCALLS_New                           (con);  break;
				case "SPCALLS_UPDATE"                        :  cmd = cmdCALLS_Update                        (con);  break;
				case "SPCALLS_USERS_DELETE"                  :  cmd = cmdCALLS_USERS_Delete                  (con);  break;
				case "SPCALLS_USERS_UPDATE"                  :  cmd = cmdCALLS_USERS_Update                  (con);  break;
				case "SPCAMPAIGN_LOG_BANNERTRACKER"          :  cmd = cmdCAMPAIGN_LOG_BannerTracker          (con);  break;
				case "SPCAMPAIGN_LOG_DELETE"                 :  cmd = cmdCAMPAIGN_LOG_Delete                 (con);  break;
				case "SPCAMPAIGN_LOG_INSERTONLY"             :  cmd = cmdCAMPAIGN_LOG_InsertOnly             (con);  break;
				case "SPCAMPAIGN_LOG_UPDATE"                 :  cmd = cmdCAMPAIGN_LOG_Update                 (con);  break;
				case "SPCAMPAIGN_LOG_UPDATETRACKER"          :  cmd = cmdCAMPAIGN_LOG_UpdateTracker          (con);  break;
				case "SPCAMPAIGN_TRKRS_DELETE"               :  cmd = cmdCAMPAIGN_TRKRS_Delete               (con);  break;
				case "SPCAMPAIGN_TRKRS_UPDATE"               :  cmd = cmdCAMPAIGN_TRKRS_Update               (con);  break;
				case "SPCAMPAIGNS_DELETE"                    :  cmd = cmdCAMPAIGNS_Delete                    (con);  break;
				case "SPCAMPAIGNS_DELETETESTENTRIES"         :  cmd = cmdCAMPAIGNS_DeleteTestEntries         (con);  break;
				case "SPCAMPAIGNS_MASSDELETE"                :  cmd = cmdCAMPAIGNS_MassDelete                (con);  break;
				case "SPCAMPAIGNS_MASSUPDATE"                :  cmd = cmdCAMPAIGNS_MassUpdate                (con);  break;
				case "SPCAMPAIGNS_NEW"                       :  cmd = cmdCAMPAIGNS_New                       (con);  break;
				case "SPCAMPAIGNS_OPTOUT"                    :  cmd = cmdCAMPAIGNS_OptOut                    (con);  break;
				case "SPCAMPAIGNS_SENDEMAIL"                 :  cmd = cmdCAMPAIGNS_SendEmail                 (con);  break;
				case "SPCAMPAIGNS_UPDATE"                    :  cmd = cmdCAMPAIGNS_Update                    (con);  break;
				case "SPCASES_BUGS_DELETE"                   :  cmd = cmdCASES_BUGS_Delete                   (con);  break;
				case "SPCASES_BUGS_UPDATE"                   :  cmd = cmdCASES_BUGS_Update                   (con);  break;
				case "SPCASES_DELETE"                        :  cmd = cmdCASES_Delete                        (con);  break;
				case "SPCASES_MASSDELETE"                    :  cmd = cmdCASES_MassDelete                    (con);  break;
				case "SPCASES_MASSUPDATE"                    :  cmd = cmdCASES_MassUpdate                    (con);  break;
				case "SPCASES_NEW"                           :  cmd = cmdCASES_New                           (con);  break;
				case "SPCASES_THREADS_DELETE"                :  cmd = cmdCASES_THREADS_Delete                (con);  break;
				case "SPCASES_THREADS_UPDATE"                :  cmd = cmdCASES_THREADS_Update                (con);  break;
				case "SPCASES_UPDATE"                        :  cmd = cmdCASES_Update                        (con);  break;
				case "SPCONFIG_DELETE"                       :  cmd = cmdCONFIG_Delete                       (con);  break;
				case "SPCONFIG_INSERTONLY"                   :  cmd = cmdCONFIG_InsertOnly                   (con);  break;
				case "SPCONFIG_MASSDELETE"                   :  cmd = cmdCONFIG_MassDelete                   (con);  break;
				case "SPCONFIG_UPDATE"                       :  cmd = cmdCONFIG_Update                       (con);  break;
				case "SPCONTACTS_BUGS_DELETE"                :  cmd = cmdCONTACTS_BUGS_Delete                (con);  break;
				case "SPCONTACTS_BUGS_UPDATE"                :  cmd = cmdCONTACTS_BUGS_Update                (con);  break;
				case "SPCONTACTS_CASES_DELETE"               :  cmd = cmdCONTACTS_CASES_Delete               (con);  break;
				case "SPCONTACTS_CASES_UPDATE"               :  cmd = cmdCONTACTS_CASES_Update               (con);  break;
				case "SPCONTACTS_CONVERTLEAD"                :  cmd = cmdCONTACTS_ConvertLead                (con);  break;
				case "SPCONTACTS_DELETE"                     :  cmd = cmdCONTACTS_Delete                     (con);  break;
				case "SPCONTACTS_MASSDELETE"                 :  cmd = cmdCONTACTS_MassDelete                 (con);  break;
				case "SPCONTACTS_MASSSYNC"                   :  cmd = cmdCONTACTS_MassSync                   (con);  break;
				case "SPCONTACTS_MASSUNSYNC"                 :  cmd = cmdCONTACTS_MassUnsync                 (con);  break;
				case "SPCONTACTS_MASSUPDATE"                 :  cmd = cmdCONTACTS_MassUpdate                 (con);  break;
				case "SPCONTACTS_NEW"                        :  cmd = cmdCONTACTS_New                        (con);  break;
				case "SPCONTACTS_REPORTS_TO_UPDATE"          :  cmd = cmdCONTACTS_REPORTS_TO_Update          (con);  break;
				case "SPCONTACTS_UPDATE"                     :  cmd = cmdCONTACTS_Update                     (con);  break;
				case "SPCONTACTS_USERS_DELETE"               :  cmd = cmdCONTACTS_USERS_Delete               (con);  break;
				case "SPCONTACTS_USERS_UPDATE"               :  cmd = cmdCONTACTS_USERS_Update               (con);  break;
				case "SPCONTRACT_TYPES_DELETE"               :  cmd = cmdCONTRACT_TYPES_Delete               (con);  break;
				case "SPCONTRACT_TYPES_DOCUMENTS_DELETE"     :  cmd = cmdCONTRACT_TYPES_DOCUMENTS_Delete     (con);  break;
				case "SPCONTRACT_TYPES_DOCUMENTS_UPDATE"     :  cmd = cmdCONTRACT_TYPES_DOCUMENTS_Update     (con);  break;
				case "SPCONTRACT_TYPES_UPDATE"               :  cmd = cmdCONTRACT_TYPES_Update               (con);  break;
				case "SPCONTRACTS_CONTACTS_DELETE"           :  cmd = cmdCONTRACTS_CONTACTS_Delete           (con);  break;
				case "SPCONTRACTS_CONTACTS_UPDATE"           :  cmd = cmdCONTRACTS_CONTACTS_Update           (con);  break;
				case "SPCONTRACTS_DELETE"                    :  cmd = cmdCONTRACTS_Delete                    (con);  break;
				case "SPCONTRACTS_DOCUMENTS_DELETE"          :  cmd = cmdCONTRACTS_DOCUMENTS_Delete          (con);  break;
				case "SPCONTRACTS_DOCUMENTS_GETLATEST"       :  cmd = cmdCONTRACTS_DOCUMENTS_GetLatest       (con);  break;
				case "SPCONTRACTS_DOCUMENTS_UPDATE"          :  cmd = cmdCONTRACTS_DOCUMENTS_Update          (con);  break;
				case "SPCONTRACTS_MASSDELETE"                :  cmd = cmdCONTRACTS_MassDelete                (con);  break;
				case "SPCONTRACTS_MASSUPDATE"                :  cmd = cmdCONTRACTS_MassUpdate                (con);  break;
				case "SPCONTRACTS_OPPORTUNITIES_DELETE"      :  cmd = cmdCONTRACTS_OPPORTUNITIES_Delete      (con);  break;
				case "SPCONTRACTS_OPPORTUNITIES_UPDATE"      :  cmd = cmdCONTRACTS_OPPORTUNITIES_Update      (con);  break;
				case "SPCONTRACTS_PRODUCTS_DELETE"           :  cmd = cmdCONTRACTS_PRODUCTS_Delete           (con);  break;
				case "SPCONTRACTS_PRODUCTS_UPDATE"           :  cmd = cmdCONTRACTS_PRODUCTS_Update           (con);  break;
				case "SPCONTRACTS_QUOTES_DELETE"             :  cmd = cmdCONTRACTS_QUOTES_Delete             (con);  break;
				case "SPCONTRACTS_QUOTES_UPDATE"             :  cmd = cmdCONTRACTS_QUOTES_Update             (con);  break;
				case "SPCONTRACTS_UPDATE"                    :  cmd = cmdCONTRACTS_Update                    (con);  break;
				case "SPCRONRUN"                             :  cmd = cmdCronRun                             (con);  break;
				case "SPCURRENCIES_DELETE"                   :  cmd = cmdCURRENCIES_Delete                   (con);  break;
				case "SPCURRENCIES_INSERTONLY"               :  cmd = cmdCURRENCIES_InsertOnly               (con);  break;
				case "SPCURRENCIES_UPDATE"                   :  cmd = cmdCURRENCIES_Update                   (con);  break;
				case "SPCUSTOM_FIELDS_DELETE"                :  cmd = cmdCUSTOM_FIELDS_Delete                (con);  break;
				case "SPCUSTOM_FIELDS_UPDATE"                :  cmd = cmdCUSTOM_FIELDS_Update                (con);  break;
				case "SPDASHBOARDS_DELETE"                   :  cmd = cmdDASHBOARDS_Delete                   (con);  break;
				case "SPDASHBOARDS_UPDATE"                   :  cmd = cmdDASHBOARDS_Update                   (con);  break;
				case "SPDETAILVIEWS_DELETE"                  :  cmd = cmdDETAILVIEWS_Delete                  (con);  break;
				case "SPDETAILVIEWS_FIELDS_CNVBOUND"         :  cmd = cmdDETAILVIEWS_FIELDS_CnvBound         (con);  break;
				case "SPDETAILVIEWS_FIELDS_DELETE"           :  cmd = cmdDETAILVIEWS_FIELDS_Delete           (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSBLANK"         :  cmd = cmdDETAILVIEWS_FIELDS_InsBlank         (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSBOUND"         :  cmd = cmdDETAILVIEWS_FIELDS_InsBound         (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSBOUNDLIST"     :  cmd = cmdDETAILVIEWS_FIELDS_InsBoundList     (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSBUTTON"        :  cmd = cmdDETAILVIEWS_FIELDS_InsButton        (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSCHECKBOX"      :  cmd = cmdDETAILVIEWS_FIELDS_InsCheckBox      (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSERTONLY"       :  cmd = cmdDETAILVIEWS_FIELDS_InsertOnly       (con);  break;
				case "SPDETAILVIEWS_FIELDS_INSHYPERLINK"     :  cmd = cmdDETAILVIEWS_FIELDS_InsHyperLink     (con);  break;
				case "SPDETAILVIEWS_FIELDS_UPDATE"           :  cmd = cmdDETAILVIEWS_FIELDS_Update           (con);  break;
				case "SPDETAILVIEWS_INSERTONLY"              :  cmd = cmdDETAILVIEWS_InsertOnly              (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_DELETE"    :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_Delete    (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_DISABLE"   :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_Disable   (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_DOWN"      :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_Down      (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_ENABLE"    :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_Enable    (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_INSERTONLY":  cmd = cmdDETAILVIEWS_RELATIONSHIPS_InsertOnly(con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_MOVEUP"    :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_MoveUp    (con);  break;
				case "SPDETAILVIEWS_RELATIONSHIPS_UPDATE"    :  cmd = cmdDETAILVIEWS_RELATIONSHIPS_Update    (con);  break;
				case "SPDETAILVIEWS_UPDATE"                  :  cmd = cmdDETAILVIEWS_Update                  (con);  break;
				case "SPDOCUMENT_REVISIONS_DELETE"           :  cmd = cmdDOCUMENT_REVISIONS_Delete           (con);  break;
				case "SPDOCUMENT_REVISIONS_DUPLICATE"        :  cmd = cmdDOCUMENT_REVISIONS_Duplicate        (con);  break;
				case "SPDOCUMENT_REVISIONS_INSERT"           :  cmd = cmdDOCUMENT_REVISIONS_Insert           (con);  break;
				case "SPDOCUMENTS_CONTENT_INITPOINTER"       :  cmd = cmdDOCUMENTS_CONTENT_InitPointer       (con);  break;
				case "SPDOCUMENTS_CONTENT_READOFFSET"        :  cmd = cmdDOCUMENTS_CONTENT_ReadOffset        (con);  break;
				case "SPDOCUMENTS_CONTENT_WRITEOFFSET"       :  cmd = cmdDOCUMENTS_CONTENT_WriteOffset       (con);  break;
				case "SPDOCUMENTS_DELETE"                    :  cmd = cmdDOCUMENTS_Delete                    (con);  break;
				case "SPDOCUMENTS_MASSDELETE"                :  cmd = cmdDOCUMENTS_MassDelete                (con);  break;
				case "SPDOCUMENTS_MASSUPDATE"                :  cmd = cmdDOCUMENTS_MassUpdate                (con);  break;
				case "SPDOCUMENTS_UPDATE"                    :  cmd = cmdDOCUMENTS_Update                    (con);  break;
				case "SPEDITVIEWS_DELETE"                    :  cmd = cmdEDITVIEWS_Delete                    (con);  break;
				case "SPEDITVIEWS_FIELDS_CNVCHANGE"          :  cmd = cmdEDITVIEWS_FIELDS_CnvChange          (con);  break;
				case "SPEDITVIEWS_FIELDS_DELETE"             :  cmd = cmdEDITVIEWS_FIELDS_Delete             (con);  break;
				case "SPEDITVIEWS_FIELDS_INSBLANK"           :  cmd = cmdEDITVIEWS_FIELDS_InsBlank           (con);  break;
				case "SPEDITVIEWS_FIELDS_INSBOUND"           :  cmd = cmdEDITVIEWS_FIELDS_InsBound           (con);  break;
				case "SPEDITVIEWS_FIELDS_INSBOUNDLIST"       :  cmd = cmdEDITVIEWS_FIELDS_InsBoundList       (con);  break;
				case "SPEDITVIEWS_FIELDS_INSCHANGE"          :  cmd = cmdEDITVIEWS_FIELDS_InsChange          (con);  break;
				case "SPEDITVIEWS_FIELDS_INSCONTROL"         :  cmd = cmdEDITVIEWS_FIELDS_InsControl         (con);  break;
				case "SPEDITVIEWS_FIELDS_INSFILE"            :  cmd = cmdEDITVIEWS_FIELDS_InsFile            (con);  break;
				case "SPEDITVIEWS_FIELDS_INSMULTILINE"       :  cmd = cmdEDITVIEWS_FIELDS_InsMultiLine       (con);  break;
				case "SPEDITVIEWS_FIELDS_LSTCHANGE"          :  cmd = cmdEDITVIEWS_FIELDS_LstChange          (con);  break;
				case "SPEDITVIEWS_FIELDS_UPDATE"             :  cmd = cmdEDITVIEWS_FIELDS_Update             (con);  break;
				case "SPEDITVIEWS_INSERTONLY"                :  cmd = cmdEDITVIEWS_InsertOnly                (con);  break;
				case "SPEDITVIEWS_UPDATE"                    :  cmd = cmdEDITVIEWS_Update                    (con);  break;
				case "SPEMAIL_MARKETING_DELETE"              :  cmd = cmdEMAIL_MARKETING_Delete              (con);  break;
				case "SPEMAIL_MARKETING_UPDATE"              :  cmd = cmdEMAIL_MARKETING_Update              (con);  break;
				case "SPEMAIL_MKTG_PRSPT_LST_DELETE"         :  cmd = cmdEMAIL_MKTG_PRSPT_LST_Delete         (con);  break;
				case "SPEMAIL_MKTG_PRSPT_LST_UPDATE"         :  cmd = cmdEMAIL_MKTG_PRSPT_LST_Update         (con);  break;
				case "SPEMAIL_MRKT_PROSPECT_LISTS_DELETE"    :  cmd = cmdEMAIL_MRKT_PROSPECT_LISTS_Delete    (con);  break;
				case "SPEMAIL_MRKT_PROSPECT_LISTS_UPDATE"    :  cmd = cmdEMAIL_MRKT_PROSPECT_LISTS_Update    (con);  break;
				case "SPEMAIL_TEMPLATES_DELETE"              :  cmd = cmdEMAIL_TEMPLATES_Delete              (con);  break;
				case "SPEMAIL_TEMPLATES_MASSDELETE"          :  cmd = cmdEMAIL_TEMPLATES_MassDelete          (con);  break;
				case "SPEMAIL_TEMPLATES_UPDATE"              :  cmd = cmdEMAIL_TEMPLATES_Update              (con);  break;
				case "SPEMAILMAN_DELETE"                     :  cmd = cmdEMAILMAN_Delete                     (con);  break;
				case "SPEMAILMAN_MASSDELETE"                 :  cmd = cmdEMAILMAN_MassDelete                 (con);  break;
				case "SPEMAILMAN_SENDFAILED"                 :  cmd = cmdEMAILMAN_SendFailed                 (con);  break;
				case "SPEMAILMAN_SENDSUCCESSFUL"             :  cmd = cmdEMAILMAN_SendSuccessful             (con);  break;
				case "SPEMAILMAN_SENT_DELETE"                :  cmd = cmdEMAILMAN_SENT_Delete                (con);  break;
				case "SPEMAILMAN_SENT_UPDATE"                :  cmd = cmdEMAILMAN_SENT_Update                (con);  break;
				case "SPEMAILMAN_UPDATE"                     :  cmd = cmdEMAILMAN_Update                     (con);  break;
				case "SPEMAILS_ACCOUNTS_DELETE"              :  cmd = cmdEMAILS_ACCOUNTS_Delete              (con);  break;
				case "SPEMAILS_ACCOUNTS_UPDATE"              :  cmd = cmdEMAILS_ACCOUNTS_Update              (con);  break;
				case "SPEMAILS_BUGS_DELETE"                  :  cmd = cmdEMAILS_BUGS_Delete                  (con);  break;
				case "SPEMAILS_BUGS_UPDATE"                  :  cmd = cmdEMAILS_BUGS_Update                  (con);  break;
				case "SPEMAILS_CAMPAIGNREF"                  :  cmd = cmdEMAILS_CampaignRef                  (con);  break;
				case "SPEMAILS_CASES_DELETE"                 :  cmd = cmdEMAILS_CASES_Delete                 (con);  break;
				case "SPEMAILS_CASES_UPDATE"                 :  cmd = cmdEMAILS_CASES_Update                 (con);  break;
				case "SPEMAILS_CONTACTS_DELETE"              :  cmd = cmdEMAILS_CONTACTS_Delete              (con);  break;
				case "SPEMAILS_CONTACTS_UPDATE"              :  cmd = cmdEMAILS_CONTACTS_Update              (con);  break;
				case "SPEMAILS_DELETE"                       :  cmd = cmdEMAILS_Delete                       (con);  break;
				case "SPEMAILS_INSERTINBOUND"                :  cmd = cmdEMAILS_InsertInbound                (con);  break;
				case "SPEMAILS_LEADS_DELETE"                 :  cmd = cmdEMAILS_LEADS_Delete                 (con);  break;
				case "SPEMAILS_LEADS_UPDATE"                 :  cmd = cmdEMAILS_LEADS_Update                 (con);  break;
				case "SPEMAILS_MASSDELETE"                   :  cmd = cmdEMAILS_MassDelete                   (con);  break;
				case "SPEMAILS_MASSUPDATE"                   :  cmd = cmdEMAILS_MassUpdate                   (con);  break;
				case "SPEMAILS_OPPORTUNITIES_DELETE"         :  cmd = cmdEMAILS_OPPORTUNITIES_Delete         (con);  break;
				case "SPEMAILS_OPPORTUNITIES_UPDATE"         :  cmd = cmdEMAILS_OPPORTUNITIES_Update         (con);  break;
				case "SPEMAILS_PROJECT_TASKS_DELETE"         :  cmd = cmdEMAILS_PROJECT_TASKS_Delete         (con);  break;
				case "SPEMAILS_PROJECT_TASKS_UPDATE"         :  cmd = cmdEMAILS_PROJECT_TASKS_Update         (con);  break;
				case "SPEMAILS_PROJECTS_DELETE"              :  cmd = cmdEMAILS_PROJECTS_Delete              (con);  break;
				case "SPEMAILS_PROJECTS_UPDATE"              :  cmd = cmdEMAILS_PROJECTS_Update              (con);  break;
				case "SPEMAILS_PROSPECTS_DELETE"             :  cmd = cmdEMAILS_PROSPECTS_Delete             (con);  break;
				case "SPEMAILS_PROSPECTS_UPDATE"             :  cmd = cmdEMAILS_PROSPECTS_Update             (con);  break;
				case "SPEMAILS_QUOTES_DELETE"                :  cmd = cmdEMAILS_QUOTES_Delete                (con);  break;
				case "SPEMAILS_QUOTES_UPDATE"                :  cmd = cmdEMAILS_QUOTES_Update                (con);  break;
				case "SPEMAILS_TASKS_DELETE"                 :  cmd = cmdEMAILS_TASKS_Delete                 (con);  break;
				case "SPEMAILS_TASKS_UPDATE"                 :  cmd = cmdEMAILS_TASKS_Update                 (con);  break;
				case "SPEMAILS_UPDATE"                       :  cmd = cmdEMAILS_Update                       (con);  break;
				case "SPEMAILS_UPDATESTATUS"                 :  cmd = cmdEMAILS_UpdateStatus                 (con);  break;
				case "SPEMAILS_USERS_DELETE"                 :  cmd = cmdEMAILS_USERS_Delete                 (con);  break;
				case "SPEMAILS_USERS_UPDATE"                 :  cmd = cmdEMAILS_USERS_Update                 (con);  break;
				case "SPEMPLOYEES_UPDATE"                    :  cmd = cmdEMPLOYEES_Update                    (con);  break;
				case "SPFEEDS_DELETE"                        :  cmd = cmdFEEDS_Delete                        (con);  break;
				case "SPFEEDS_NEW"                           :  cmd = cmdFEEDS_New                           (con);  break;
				case "SPFEEDS_UPDATE"                        :  cmd = cmdFEEDS_Update                        (con);  break;
				case "SPFIELDS_META_DATA_DELETE"             :  cmd = cmdFIELDS_META_DATA_Delete             (con);  break;
				case "SPFIELDS_META_DATA_INSERT"             :  cmd = cmdFIELDS_META_DATA_Insert             (con);  break;
				case "SPFIELDS_META_DATA_UPDATE"             :  cmd = cmdFIELDS_META_DATA_Update             (con);  break;
				case "SPFILES_DELETE"                        :  cmd = cmdFILES_Delete                        (con);  break;
				case "SPFILES_UPDATE"                        :  cmd = cmdFILES_Update                        (con);  break;
				case "SPFORECASTS_DELETE"                    :  cmd = cmdFORECASTS_Delete                    (con);  break;
				case "SPFORECASTS_OPPORTUNITIES_DELETE"      :  cmd = cmdFORECASTS_OPPORTUNITIES_Delete      (con);  break;
				case "SPFORECASTS_OPPORTUNITIES_UPDATE"      :  cmd = cmdFORECASTS_OPPORTUNITIES_Update      (con);  break;
				case "SPFORECASTS_UPDATE"                    :  cmd = cmdFORECASTS_Update                    (con);  break;
				case "SPFORUM_TOPICS_DELETE"                 :  cmd = cmdFORUM_TOPICS_Delete                 (con);  break;
				case "SPFORUM_TOPICS_UPDATE"                 :  cmd = cmdFORUM_TOPICS_Update                 (con);  break;
				case "SPFORUMS_DELETE"                       :  cmd = cmdFORUMS_Delete                       (con);  break;
				case "SPFORUMS_UPDATE"                       :  cmd = cmdFORUMS_Update                       (con);  break;
				case "SPFORUMS_UPDATETHREADCOUNT"            :  cmd = cmdFORUMS_UpdateThreadCount            (con);  break;
				case "SPGRIDVIEWS_COLUMNS_DELETE"            :  cmd = cmdGRIDVIEWS_COLUMNS_Delete            (con);  break;
				case "SPGRIDVIEWS_COLUMNS_INSBOUND"          :  cmd = cmdGRIDVIEWS_COLUMNS_InsBound          (con);  break;
				case "SPGRIDVIEWS_COLUMNS_INSBOUNDDATE"      :  cmd = cmdGRIDVIEWS_COLUMNS_InsBoundDate      (con);  break;
				case "SPGRIDVIEWS_COLUMNS_INSBOUNDLIST"      :  cmd = cmdGRIDVIEWS_COLUMNS_InsBoundList      (con);  break;
				case "SPGRIDVIEWS_COLUMNS_INSFIELD"          :  cmd = cmdGRIDVIEWS_COLUMNS_InsField          (con);  break;
				case "SPGRIDVIEWS_COLUMNS_INSHYPERLINK"      :  cmd = cmdGRIDVIEWS_COLUMNS_InsHyperLink      (con);  break;
				case "SPGRIDVIEWS_COLUMNS_UPDATE"            :  cmd = cmdGRIDVIEWS_COLUMNS_Update            (con);  break;
				case "SPGRIDVIEWS_COLUMNS_UPDATESTYLE"       :  cmd = cmdGRIDVIEWS_COLUMNS_UpdateStyle       (con);  break;
				case "SPGRIDVIEWS_DELETE"                    :  cmd = cmdGRIDVIEWS_Delete                    (con);  break;
				case "SPGRIDVIEWS_INSERTONLY"                :  cmd = cmdGRIDVIEWS_InsertOnly                (con);  break;
				case "SPGRIDVIEWS_UPDATE"                    :  cmd = cmdGRIDVIEWS_Update                    (con);  break;
				case "SPIFRAMES_DELETE"                      :  cmd = cmdIFRAMES_Delete                      (con);  break;
				case "SPIFRAMES_MASSDELETE"                  :  cmd = cmdIFRAMES_MassDelete                  (con);  break;
				case "SPIFRAMES_UPDATE"                      :  cmd = cmdIFRAMES_Update                      (con);  break;
				case "SPIMAGE_INITPOINTER"                   :  cmd = cmdIMAGE_InitPointer                   (con);  break;
				case "SPIMAGE_READOFFSET"                    :  cmd = cmdIMAGE_ReadOffset                    (con);  break;
				case "SPIMAGE_WRITEOFFSET"                   :  cmd = cmdIMAGE_WriteOffset                   (con);  break;
				case "SPIMAGES_DELETE"                       :  cmd = cmdIMAGES_Delete                       (con);  break;
				case "SPIMAGES_INSERT"                       :  cmd = cmdIMAGES_Insert                       (con);  break;
				case "SPIMPORT_MAPS_DELETE"                  :  cmd = cmdIMPORT_MAPS_Delete                  (con);  break;
				case "SPIMPORT_MAPS_UPDATE"                  :  cmd = cmdIMPORT_MAPS_Update                  (con);  break;
				case "SPINBOUND_EMAIL_AUTOREPLY_DELETE"      :  cmd = cmdINBOUND_EMAIL_AUTOREPLY_Delete      (con);  break;
				case "SPINBOUND_EMAIL_AUTOREPLY_UPDATE"      :  cmd = cmdINBOUND_EMAIL_AUTOREPLY_Update      (con);  break;
				case "SPINBOUND_EMAILS_DELETE"               :  cmd = cmdINBOUND_EMAILS_Delete               (con);  break;
				case "SPINBOUND_EMAILS_UPDATE"               :  cmd = cmdINBOUND_EMAILS_Update               (con);  break;
				case "SPINVOICES_ACCOUNTS_UPDATE"            :  cmd = cmdINVOICES_ACCOUNTS_Update            (con);  break;
				case "SPINVOICES_CONTACTS_UPDATE"            :  cmd = cmdINVOICES_CONTACTS_Update            (con);  break;
				case "SPINVOICES_CONVERTORDER"               :  cmd = cmdINVOICES_ConvertOrder               (con);  break;
				case "SPINVOICES_DELETE"                     :  cmd = cmdINVOICES_Delete                     (con);  break;
				case "SPINVOICES_LINE_ITEMS_DELETE"          :  cmd = cmdINVOICES_LINE_ITEMS_Delete          (con);  break;
				case "SPINVOICES_LINE_ITEMS_UPDATE"          :  cmd = cmdINVOICES_LINE_ITEMS_Update          (con);  break;
				case "SPINVOICES_MASSDELETE"                 :  cmd = cmdINVOICES_MassDelete                 (con);  break;
				case "SPINVOICES_MASSUPDATE"                 :  cmd = cmdINVOICES_MassUpdate                 (con);  break;
				case "SPINVOICES_PAYMENTS_DELETE"            :  cmd = cmdINVOICES_PAYMENTS_Delete            (con);  break;
				case "SPINVOICES_PAYMENTS_UPDATE"            :  cmd = cmdINVOICES_PAYMENTS_Update            (con);  break;
				case "SPINVOICES_UPDATE"                     :  cmd = cmdINVOICES_Update                     (con);  break;
				case "SPINVOICES_UPDATETOTALS"               :  cmd = cmdINVOICES_UpdateTotals               (con);  break;
				case "SPLANGUAGES_DELETE"                    :  cmd = cmdLANGUAGES_Delete                    (con);  break;
				case "SPLANGUAGES_INSERTONLY"                :  cmd = cmdLANGUAGES_InsertOnly                (con);  break;
				case "SPLANGUAGES_UPDATE"                    :  cmd = cmdLANGUAGES_Update                    (con);  break;
				case "SPLEADS_CONVERTPROSPECT"               :  cmd = cmdLEADS_ConvertProspect               (con);  break;
				case "SPLEADS_DELETE"                        :  cmd = cmdLEADS_Delete                        (con);  break;
				case "SPLEADS_MASSDELETE"                    :  cmd = cmdLEADS_MassDelete                    (con);  break;
				case "SPLEADS_MASSUPDATE"                    :  cmd = cmdLEADS_MassUpdate                    (con);  break;
				case "SPLEADS_NEW"                           :  cmd = cmdLEADS_New                           (con);  break;
				case "SPLEADS_THREADS_DELETE"                :  cmd = cmdLEADS_THREADS_Delete                (con);  break;
				case "SPLEADS_THREADS_UPDATE"                :  cmd = cmdLEADS_THREADS_Update                (con);  break;
				case "SPLEADS_UPDATE"                        :  cmd = cmdLEADS_Update                        (con);  break;
				case "SPLINKED_DOCUMENTS_DELETE"             :  cmd = cmdLINKED_DOCUMENTS_Delete             (con);  break;
				case "SPLINKED_DOCUMENTS_UPDATE"             :  cmd = cmdLINKED_DOCUMENTS_Update             (con);  break;
				case "SPMANUFACTURERS_DELETE"                :  cmd = cmdMANUFACTURERS_Delete                (con);  break;
				case "SPMANUFACTURERS_UPDATE"                :  cmd = cmdMANUFACTURERS_Update                (con);  break;
				case "SPMEETINGS_CONTACTS_DELETE"            :  cmd = cmdMEETINGS_CONTACTS_Delete            (con);  break;
				case "SPMEETINGS_CONTACTS_UPDATE"            :  cmd = cmdMEETINGS_CONTACTS_Update            (con);  break;
				case "SPMEETINGS_DELETE"                     :  cmd = cmdMEETINGS_Delete                     (con);  break;
				case "SPMEETINGS_INVITEEMASSUPDATE"          :  cmd = cmdMEETINGS_InviteeMassUpdate          (con);  break;
				case "SPMEETINGS_MASSDELETE"                 :  cmd = cmdMEETINGS_MassDelete                 (con);  break;
				case "SPMEETINGS_MASSUPDATE"                 :  cmd = cmdMEETINGS_MassUpdate                 (con);  break;
				case "SPMEETINGS_NEW"                        :  cmd = cmdMEETINGS_New                        (con);  break;
				case "SPMEETINGS_UPDATE"                     :  cmd = cmdMEETINGS_Update                     (con);  break;
				case "SPMEETINGS_USERS_DELETE"               :  cmd = cmdMEETINGS_USERS_Delete               (con);  break;
				case "SPMEETINGS_USERS_UPDATE"               :  cmd = cmdMEETINGS_USERS_Update               (con);  break;
				case "SPMODULES_DELETE"                      :  cmd = cmdMODULES_Delete                      (con);  break;
				case "SPMODULES_DISABLE"                     :  cmd = cmdMODULES_Disable                     (con);  break;
				case "SPMODULES_ENABLE"                      :  cmd = cmdMODULES_Enable                      (con);  break;
				case "SPMODULES_INSERTONLY"                  :  cmd = cmdMODULES_InsertOnly                  (con);  break;
				case "SPMODULES_TAB_HIDE"                    :  cmd = cmdMODULES_TAB_Hide                    (con);  break;
				case "SPMODULES_TAB_HIDEMOBILE"              :  cmd = cmdMODULES_TAB_HideMobile              (con);  break;
				case "SPMODULES_TAB_ORDER_MOVEDOWN"          :  cmd = cmdMODULES_TAB_ORDER_MoveDown          (con);  break;
				case "SPMODULES_TAB_ORDER_MOVEUP"            :  cmd = cmdMODULES_TAB_ORDER_MoveUp            (con);  break;
				case "SPMODULES_TAB_RENAME"                  :  cmd = cmdMODULES_TAB_Rename                  (con);  break;
				case "SPMODULES_TAB_SHOW"                    :  cmd = cmdMODULES_TAB_Show                    (con);  break;
				case "SPMODULES_TAB_SHOWMOBILE"              :  cmd = cmdMODULES_TAB_ShowMobile              (con);  break;
				case "SPMODULES_UPDATE"                      :  cmd = cmdMODULES_Update                      (con);  break;
				case "SPNOTE_ATTACHMENTS_DELETE"             :  cmd = cmdNOTE_ATTACHMENTS_Delete             (con);  break;
				case "SPNOTE_ATTACHMENTS_INSERT"             :  cmd = cmdNOTE_ATTACHMENTS_Insert             (con);  break;
				case "SPNOTES_ATTACHMENT_INITPOINTER"        :  cmd = cmdNOTES_ATTACHMENT_InitPointer        (con);  break;
				case "SPNOTES_ATTACHMENT_READOFFSET"         :  cmd = cmdNOTES_ATTACHMENT_ReadOffset         (con);  break;
				case "SPNOTES_ATTACHMENT_WRITEOFFSET"        :  cmd = cmdNOTES_ATTACHMENT_WriteOffset        (con);  break;
				case "SPNOTES_COPY"                          :  cmd = cmdNOTES_Copy                          (con);  break;
				case "SPNOTES_DELETE"                        :  cmd = cmdNOTES_Delete                        (con);  break;
				case "SPNOTES_MASSDELETE"                    :  cmd = cmdNOTES_MassDelete                    (con);  break;
				case "SPNOTES_MASSUPDATE"                    :  cmd = cmdNOTES_MassUpdate                    (con);  break;
				case "SPNOTES_NEW"                           :  cmd = cmdNOTES_New                           (con);  break;
				case "SPNOTES_UPDATE"                        :  cmd = cmdNOTES_Update                        (con);  break;
				case "SPOPPORTUNITIES_CONTACTS_DELETE"       :  cmd = cmdOPPORTUNITIES_CONTACTS_Delete       (con);  break;
				case "SPOPPORTUNITIES_CONTACTS_UPDATE"       :  cmd = cmdOPPORTUNITIES_CONTACTS_Update       (con);  break;
				case "SPOPPORTUNITIES_DELETE"                :  cmd = cmdOPPORTUNITIES_Delete                (con);  break;
				case "SPOPPORTUNITIES_MASSDELETE"            :  cmd = cmdOPPORTUNITIES_MassDelete            (con);  break;
				case "SPOPPORTUNITIES_MASSUPDATE"            :  cmd = cmdOPPORTUNITIES_MassUpdate            (con);  break;
				case "SPOPPORTUNITIES_NEW"                   :  cmd = cmdOPPORTUNITIES_New                   (con);  break;
				case "SPOPPORTUNITIES_THREADS_DELETE"        :  cmd = cmdOPPORTUNITIES_THREADS_Delete        (con);  break;
				case "SPOPPORTUNITIES_THREADS_UPDATE"        :  cmd = cmdOPPORTUNITIES_THREADS_Update        (con);  break;
				case "SPOPPORTUNITIES_UPDATE"                :  cmd = cmdOPPORTUNITIES_Update                (con);  break;
				case "SPORDERS_ACCOUNTS_DELETE"              :  cmd = cmdORDERS_ACCOUNTS_Delete              (con);  break;
				case "SPORDERS_ACCOUNTS_UPDATE"              :  cmd = cmdORDERS_ACCOUNTS_Update              (con);  break;
				case "SPORDERS_CONTACTS_DELETE"              :  cmd = cmdORDERS_CONTACTS_Delete              (con);  break;
				case "SPORDERS_CONTACTS_UPDATE"              :  cmd = cmdORDERS_CONTACTS_Update              (con);  break;
				case "SPORDERS_DELETE"                       :  cmd = cmdORDERS_Delete                       (con);  break;
				case "SPORDERS_ITEMS_DELETE"                 :  cmd = cmdORDERS_ITEMS_Delete                 (con);  break;
				case "SPORDERS_ITEMS_LINEITEMUPDATE"         :  cmd = cmdORDERS_ITEMS_LineItemUpdate         (con);  break;
				case "SPORDERS_LINE_ITEMS_DELETE"            :  cmd = cmdORDERS_LINE_ITEMS_Delete            (con);  break;
				case "SPORDERS_LINE_ITEMS_UPDATE"            :  cmd = cmdORDERS_LINE_ITEMS_Update            (con);  break;
				case "SPORDERS_MASSDELETE"                   :  cmd = cmdORDERS_MassDelete                   (con);  break;
				case "SPORDERS_MASSUPDATE"                   :  cmd = cmdORDERS_MassUpdate                   (con);  break;
				case "SPORDERS_OPPORTUNITIES_DELETE"         :  cmd = cmdORDERS_OPPORTUNITIES_Delete         (con);  break;
				case "SPORDERS_OPPORTUNITIES_UPDATE"         :  cmd = cmdORDERS_OPPORTUNITIES_Update         (con);  break;
				case "SPORDERS_UPDATE"                       :  cmd = cmdORDERS_Update                       (con);  break;
				case "SPORDERS_UPDATETOTALS"                 :  cmd = cmdORDERS_UpdateTotals                 (con);  break;
				case "SPPARENT_DELETE"                       :  cmd = cmdPARENT_Delete                       (con);  break;
				case "SPPARENT_GET"                          :  cmd = cmdPARENT_Get                          (con);  break;
				case "SPPAYMENTS_DELETE"                     :  cmd = cmdPAYMENTS_Delete                     (con);  break;
				case "SPPAYMENTS_MASSUPDATE"                 :  cmd = cmdPAYMENTS_MassUpdate                 (con);  break;
				case "SPPAYMENTS_UPDATE"                     :  cmd = cmdPAYMENTS_Update                     (con);  break;
				case "SPPOSTS_DELETE"                        :  cmd = cmdPOSTS_Delete                        (con);  break;
				case "SPPOSTS_UPDATE"                        :  cmd = cmdPOSTS_Update                        (con);  break;
				case "SPPRODUCT_CATEGORIES_DELETE"           :  cmd = cmdPRODUCT_CATEGORIES_Delete           (con);  break;
				case "SPPRODUCT_CATEGORIES_UPDATE"           :  cmd = cmdPRODUCT_CATEGORIES_Update           (con);  break;
				case "SPPRODUCT_PRODUCT_DELETE"              :  cmd = cmdPRODUCT_PRODUCT_Delete              (con);  break;
				case "SPPRODUCT_PRODUCT_UPDATE"              :  cmd = cmdPRODUCT_PRODUCT_Update              (con);  break;
				case "SPPRODUCT_TEMPLATES_DELETE"            :  cmd = cmdPRODUCT_TEMPLATES_Delete            (con);  break;
				case "SPPRODUCT_TEMPLATES_UPDATE"            :  cmd = cmdPRODUCT_TEMPLATES_Update            (con);  break;
				case "SPPRODUCT_TYPES_DELETE"                :  cmd = cmdPRODUCT_TYPES_Delete                (con);  break;
				case "SPPRODUCT_TYPES_UPDATE"                :  cmd = cmdPRODUCT_TYPES_Update                (con);  break;
				case "SPPRODUCTS_DELETE"                     :  cmd = cmdPRODUCTS_Delete                     (con);  break;
				case "SPPRODUCTS_MASSDELETE"                 :  cmd = cmdPRODUCTS_MassDelete                 (con);  break;
				case "SPPRODUCTS_UPDATE"                     :  cmd = cmdPRODUCTS_Update                     (con);  break;
				case "SPPROJECT_RELATION_DELETE"             :  cmd = cmdPROJECT_RELATION_Delete             (con);  break;
				case "SPPROJECT_RELATION_UPDATE"             :  cmd = cmdPROJECT_RELATION_Update             (con);  break;
				case "SPPROJECT_TASKS_DELETE"                :  cmd = cmdPROJECT_TASKS_Delete                (con);  break;
				case "SPPROJECT_TASKS_MASSDELETE"            :  cmd = cmdPROJECT_TASKS_MassDelete            (con);  break;
				case "SPPROJECT_TASKS_MASSUPDATE"            :  cmd = cmdPROJECT_TASKS_MassUpdate            (con);  break;
				case "SPPROJECT_TASKS_NEW"                   :  cmd = cmdPROJECT_TASKS_New                   (con);  break;
				case "SPPROJECT_TASKS_UPDATE"                :  cmd = cmdPROJECT_TASKS_Update                (con);  break;
				case "SPPROJECT_THREADS_DELETE"              :  cmd = cmdPROJECT_THREADS_Delete              (con);  break;
				case "SPPROJECT_THREADS_UPDATE"              :  cmd = cmdPROJECT_THREADS_Update              (con);  break;
				case "SPPROJECTS_DELETE"                     :  cmd = cmdPROJECTS_Delete                     (con);  break;
				case "SPPROJECTS_MASSDELETE"                 :  cmd = cmdPROJECTS_MassDelete                 (con);  break;
				case "SPPROJECTS_MASSUPDATE"                 :  cmd = cmdPROJECTS_MassUpdate                 (con);  break;
				case "SPPROJECTS_NEW"                        :  cmd = cmdPROJECTS_New                        (con);  break;
				case "SPPROJECTS_UPDATE"                     :  cmd = cmdPROJECTS_Update                     (con);  break;
				case "SPPROSPECT_LIST_CAMPAIGNS_DELETE"      :  cmd = cmdPROSPECT_LIST_CAMPAIGNS_Delete      (con);  break;
				case "SPPROSPECT_LIST_CAMPAIGNS_UPDATE"      :  cmd = cmdPROSPECT_LIST_CAMPAIGNS_Update      (con);  break;
				case "SPPROSPECT_LISTS_CONTACTS_DELETE"      :  cmd = cmdPROSPECT_LISTS_CONTACTS_Delete      (con);  break;
				case "SPPROSPECT_LISTS_CONTACTS_MASSUPDATE"  :  cmd = cmdPROSPECT_LISTS_CONTACTS_MassUpdate  (con);  break;
				case "SPPROSPECT_LISTS_CONTACTS_UPDATE"      :  cmd = cmdPROSPECT_LISTS_CONTACTS_Update      (con);  break;
				case "SPPROSPECT_LISTS_DELETE"               :  cmd = cmdPROSPECT_LISTS_Delete               (con);  break;
				case "SPPROSPECT_LISTS_LEADS_DELETE"         :  cmd = cmdPROSPECT_LISTS_LEADS_Delete         (con);  break;
				case "SPPROSPECT_LISTS_LEADS_MASSUPDATE"     :  cmd = cmdPROSPECT_LISTS_LEADS_MassUpdate     (con);  break;
				case "SPPROSPECT_LISTS_LEADS_UPDATE"         :  cmd = cmdPROSPECT_LISTS_LEADS_Update         (con);  break;
				case "SPPROSPECT_LISTS_MASSDELETE"           :  cmd = cmdPROSPECT_LISTS_MassDelete           (con);  break;
				case "SPPROSPECT_LISTS_MASSUPDATE"           :  cmd = cmdPROSPECT_LISTS_MassUpdate           (con);  break;
				case "SPPROSPECT_LISTS_NEW"                  :  cmd = cmdPROSPECT_LISTS_New                  (con);  break;
				case "SPPROSPECT_LISTS_PROSPECTS_DELETE"     :  cmd = cmdPROSPECT_LISTS_PROSPECTS_Delete     (con);  break;
				case "SPPROSPECT_LISTS_PROSPECTS_MASSUPDATE" :  cmd = cmdPROSPECT_LISTS_PROSPECTS_MassUpdate (con);  break;
				case "SPPROSPECT_LISTS_PROSPECTS_UPDATE"     :  cmd = cmdPROSPECT_LISTS_PROSPECTS_Update     (con);  break;
				case "SPPROSPECT_LISTS_UPDATE"               :  cmd = cmdPROSPECT_LISTS_Update               (con);  break;
				case "SPPROSPECT_LISTS_USERS_DELETE"         :  cmd = cmdPROSPECT_LISTS_USERS_Delete         (con);  break;
				case "SPPROSPECT_LISTS_USERS_MASSUPDATE"     :  cmd = cmdPROSPECT_LISTS_USERS_MassUpdate     (con);  break;
				case "SPPROSPECT_LISTS_USERS_UPDATE"         :  cmd = cmdPROSPECT_LISTS_USERS_Update         (con);  break;
				case "SPPROSPECTS_DELETE"                    :  cmd = cmdPROSPECTS_Delete                    (con);  break;
				case "SPPROSPECTS_MASSDELETE"                :  cmd = cmdPROSPECTS_MassDelete                (con);  break;
				case "SPPROSPECTS_MASSUPDATE"                :  cmd = cmdPROSPECTS_MassUpdate                (con);  break;
				case "SPPROSPECTS_NEW"                       :  cmd = cmdPROSPECTS_New                       (con);  break;
				case "SPPROSPECTS_UPDATE"                    :  cmd = cmdPROSPECTS_Update                    (con);  break;
				case "SPQUOTES_ACCOUNTS_DELETE"              :  cmd = cmdQUOTES_ACCOUNTS_Delete              (con);  break;
				case "SPQUOTES_ACCOUNTS_UPDATE"              :  cmd = cmdQUOTES_ACCOUNTS_Update              (con);  break;
				case "SPQUOTES_CONTACTS_DELETE"              :  cmd = cmdQUOTES_CONTACTS_Delete              (con);  break;
				case "SPQUOTES_CONTACTS_UPDATE"              :  cmd = cmdQUOTES_CONTACTS_Update              (con);  break;
				case "SPQUOTES_DELETE"                       :  cmd = cmdQUOTES_Delete                       (con);  break;
				case "SPQUOTES_LINE_ITEMS_DELETE"            :  cmd = cmdQUOTES_LINE_ITEMS_Delete            (con);  break;
				case "SPQUOTES_LINE_ITEMS_UPDATE"            :  cmd = cmdQUOTES_LINE_ITEMS_Update            (con);  break;
				case "SPQUOTES_MASSDELETE"                   :  cmd = cmdQUOTES_MassDelete                   (con);  break;
				case "SPQUOTES_MASSUPDATE"                   :  cmd = cmdQUOTES_MassUpdate                   (con);  break;
				case "SPQUOTES_NEW"                          :  cmd = cmdQUOTES_New                          (con);  break;
				case "SPQUOTES_OPPORTUNITIES_DELETE"         :  cmd = cmdQUOTES_OPPORTUNITIES_Delete         (con);  break;
				case "SPQUOTES_OPPORTUNITIES_UPDATE"         :  cmd = cmdQUOTES_OPPORTUNITIES_Update         (con);  break;
				case "SPQUOTES_UPDATE"                       :  cmd = cmdQUOTES_Update                       (con);  break;
				case "SPQUOTES_UPDATETOTALS"                 :  cmd = cmdQUOTES_UpdateTotals                 (con);  break;
				case "SPRELATIONSHIPS_DELETE"                :  cmd = cmdRELATIONSHIPS_Delete                (con);  break;
				case "SPRELATIONSHIPS_INSERTONLY"            :  cmd = cmdRELATIONSHIPS_InsertOnly            (con);  break;
				case "SPRELATIONSHIPS_UPDATE"                :  cmd = cmdRELATIONSHIPS_Update                (con);  break;
				case "SPRELEASES_DELETE"                     :  cmd = cmdRELEASES_Delete                     (con);  break;
				case "SPRELEASES_MASSDELETE"                 :  cmd = cmdRELEASES_MassDelete                 (con);  break;
				case "SPRELEASES_MASSUPDATE"                 :  cmd = cmdRELEASES_MassUpdate                 (con);  break;
				case "SPRELEASES_UPDATE"                     :  cmd = cmdRELEASES_Update                     (con);  break;
				case "SPREPORTS_DELETE"                      :  cmd = cmdREPORTS_Delete                      (con);  break;
				case "SPREPORTS_PUBLISH"                     :  cmd = cmdREPORTS_Publish                     (con);  break;
				case "SPREPORTS_UNPUBLISH"                   :  cmd = cmdREPORTS_Unpublish                   (con);  break;
				case "SPREPORTS_UPDATE"                      :  cmd = cmdREPORTS_Update                      (con);  break;
				case "SPROLES_DELETE"                        :  cmd = cmdROLES_Delete                        (con);  break;
				case "SPROLES_MASSDELETE"                    :  cmd = cmdROLES_MassDelete                    (con);  break;
				case "SPROLES_MODULES_DELETE"                :  cmd = cmdROLES_MODULES_Delete                (con);  break;
				case "SPROLES_MODULES_UPDATE"                :  cmd = cmdROLES_MODULES_Update                (con);  break;
				case "SPROLES_UPDATE"                        :  cmd = cmdROLES_Update                        (con);  break;
				case "SPROLES_USERS_DELETE"                  :  cmd = cmdROLES_USERS_Delete                  (con);  break;
				case "SPROLES_USERS_MASSUPDATE"              :  cmd = cmdROLES_USERS_MassUpdate              (con);  break;
				case "SPROLES_USERS_UPDATE"                  :  cmd = cmdROLES_USERS_Update                  (con);  break;
				case "SPSAVED_SEARCH_DELETE"                 :  cmd = cmdSAVED_SEARCH_Delete                 (con);  break;
				case "SPSAVED_SEARCH_UPDATE"                 :  cmd = cmdSAVED_SEARCH_Update                 (con);  break;
				case "SPSCHEDULERS_DELETE"                   :  cmd = cmdSCHEDULERS_Delete                   (con);  break;
				case "SPSCHEDULERS_INSERTONLY"               :  cmd = cmdSCHEDULERS_InsertOnly               (con);  break;
				case "SPSCHEDULERS_TIMES_DELETE"             :  cmd = cmdSCHEDULERS_TIMES_Delete             (con);  break;
				case "SPSCHEDULERS_TIMES_UPDATE"             :  cmd = cmdSCHEDULERS_TIMES_Update             (con);  break;
				case "SPSCHEDULERS_UPDATE"                   :  cmd = cmdSCHEDULERS_Update                   (con);  break;
				case "SPSCHEDULERS_UPDATELASTRUN"            :  cmd = cmdSCHEDULERS_UpdateLastRun            (con);  break;
				case "SPSCHEDULERS_UPDATESTATUS"             :  cmd = cmdSCHEDULERS_UpdateStatus             (con);  break;
				case "SPSHIPPERS_DELETE"                     :  cmd = cmdSHIPPERS_Delete                     (con);  break;
				case "SPSHIPPERS_UPDATE"                     :  cmd = cmdSHIPPERS_Update                     (con);  break;
				case "SPSHORTCUTS_DELETE"                    :  cmd = cmdSHORTCUTS_Delete                    (con);  break;
				case "SPSHORTCUTS_INSERTONLY"                :  cmd = cmdSHORTCUTS_InsertOnly                (con);  break;
				case "SPSHORTCUTS_ORDER_MOVEDOWN"            :  cmd = cmdSHORTCUTS_ORDER_MoveDown            (con);  break;
				case "SPSHORTCUTS_ORDER_MOVEUP"              :  cmd = cmdSHORTCUTS_ORDER_MoveUp              (con);  break;
				case "SPSHORTCUTS_UPDATE"                    :  cmd = cmdSHORTCUTS_Update                    (con);  break;
				case "SPSQLBACKUPDATABASE"                   :  cmd = cmdSqlBackupDatabase                   (con);  break;
				case "SPSQLBUILDALLAUDITTABLES"              :  cmd = cmdSqlBuildAllAuditTables              (con);  break;
				case "SPSQLBUILDALLAUDITTRIGGERS"            :  cmd = cmdSqlBuildAllAuditTriggers            (con);  break;
				case "SPSQLBUILDAUDITTABLE"                  :  cmd = cmdSqlBuildAuditTable                  (con);  break;
				case "SPSQLBUILDAUDITTRIGGER"                :  cmd = cmdSqlBuildAuditTrigger                (con);  break;
				case "SPSQLBUILDPROCEDURES"                  :  cmd = cmdSqlBuildProcedures                  (con);  break;
				case "SPSQLBUILDRELATIONSHIPPROCEDURES"      :  cmd = cmdSqlBuildRelationshipProcedures      (con);  break;
				case "SPSQLDROPALLAUDITTABLES"               :  cmd = cmdSqlDropAllAuditTables               (con);  break;
				case "SPSQLDROPALLAUDITTRIGGERS"             :  cmd = cmdSqlDropAllAuditTriggers             (con);  break;
				case "SPSQLPRUNEDATABASE"                    :  cmd = cmdSqlPruneDatabase                    (con);  break;
				case "SPSQLREFRESHALLVIEWS"                  :  cmd = cmdSqlRefreshAllViews                  (con);  break;
				case "SPSQLTABLEADDCOLUMN"                   :  cmd = cmdSqlTableAddColumn                   (con);  break;
				case "SPSQLTABLEALTERCOLUMN"                 :  cmd = cmdSqlTableAlterColumn                 (con);  break;
				case "SPSQLTABLEDROPCOLUMN"                  :  cmd = cmdSqlTableDropColumn                  (con);  break;
				case "SPSQLTABLEDROPCOLUMNCONSTRAINT"        :  cmd = cmdSqlTableDropColumnConstraint        (con);  break;
				case "SPTASKS_DELETE"                        :  cmd = cmdTASKS_Delete                        (con);  break;
				case "SPTASKS_MASSDELETE"                    :  cmd = cmdTASKS_MassDelete                    (con);  break;
				case "SPTASKS_MASSUPDATE"                    :  cmd = cmdTASKS_MassUpdate                    (con);  break;
				case "SPTASKS_UPDATE"                        :  cmd = cmdTASKS_Update                        (con);  break;
				case "SPTAX_RATES_DELETE"                    :  cmd = cmdTAX_RATES_Delete                    (con);  break;
				case "SPTAX_RATES_UPDATE"                    :  cmd = cmdTAX_RATES_Update                    (con);  break;
				case "SPTEAM_MEMBERSHIPS_DELETE"             :  cmd = cmdTEAM_MEMBERSHIPS_Delete             (con);  break;
				case "SPTEAM_MEMBERSHIPS_DELETEUSER"         :  cmd = cmdTEAM_MEMBERSHIPS_DeleteUser         (con);  break;
				case "SPTEAM_MEMBERSHIPS_MASSUPDATE"         :  cmd = cmdTEAM_MEMBERSHIPS_MassUpdate         (con);  break;
				case "SPTEAM_MEMBERSHIPS_REFRESHALL"         :  cmd = cmdTEAM_MEMBERSHIPS_RefreshAll         (con);  break;
				case "SPTEAM_MEMBERSHIPS_REFRESHUSER"        :  cmd = cmdTEAM_MEMBERSHIPS_RefreshUser        (con);  break;
				case "SPTEAM_MEMBERSHIPS_UPDATE"             :  cmd = cmdTEAM_MEMBERSHIPS_Update             (con);  break;
				case "SPTEAM_MEMBERSHIPS_UPDATEIMPLICIT"     :  cmd = cmdTEAM_MEMBERSHIPS_UpdateImplicit     (con);  break;
				case "SPTEAM_NOTICES_DELETE"                 :  cmd = cmdTEAM_NOTICES_Delete                 (con);  break;
				case "SPTEAM_NOTICES_MASSDELETE"             :  cmd = cmdTEAM_NOTICES_MassDelete             (con);  break;
				case "SPTEAM_NOTICES_MASSUPDATE"             :  cmd = cmdTEAM_NOTICES_MassUpdate             (con);  break;
				case "SPTEAM_NOTICES_UPDATE"                 :  cmd = cmdTEAM_NOTICES_Update                 (con);  break;
				case "SPTEAMS_DELETE"                        :  cmd = cmdTEAMS_Delete                        (con);  break;
				case "SPTEAMS_INITPRIVATE"                   :  cmd = cmdTEAMS_InitPrivate                   (con);  break;
				case "SPTEAMS_INSERTONLY"                    :  cmd = cmdTEAMS_InsertOnly                    (con);  break;
				case "SPTEAMS_INSERTPRIVATE"                 :  cmd = cmdTEAMS_InsertPrivate                 (con);  break;
				case "SPTEAMS_MASSDELETE"                    :  cmd = cmdTEAMS_MassDelete                    (con);  break;
				case "SPTEAMS_UPDATE"                        :  cmd = cmdTEAMS_Update                        (con);  break;
				case "SPTERMINOLOGY_ALIASES_DELETE"          :  cmd = cmdTERMINOLOGY_ALIASES_Delete          (con);  break;
				case "SPTERMINOLOGY_ALIASES_INSERTONLY"      :  cmd = cmdTERMINOLOGY_ALIASES_InsertOnly      (con);  break;
				case "SPTERMINOLOGY_ALIASES_UPDATE"          :  cmd = cmdTERMINOLOGY_ALIASES_Update          (con);  break;
				case "SPTERMINOLOGY_DELETE"                  :  cmd = cmdTERMINOLOGY_Delete                  (con);  break;
				case "SPTERMINOLOGY_DELETEALL"               :  cmd = cmdTERMINOLOGY_DeleteAll               (con);  break;
				case "SPTERMINOLOGY_HELP_DELETE"             :  cmd = cmdTERMINOLOGY_HELP_Delete             (con);  break;
				case "SPTERMINOLOGY_HELP_INSERTONLY"         :  cmd = cmdTERMINOLOGY_HELP_InsertOnly         (con);  break;
				case "SPTERMINOLOGY_HELP_UPDATE"             :  cmd = cmdTERMINOLOGY_HELP_Update             (con);  break;
				case "SPTERMINOLOGY_INSERTONLY"              :  cmd = cmdTERMINOLOGY_InsertOnly              (con);  break;
				case "SPTERMINOLOGY_LIST_DELETE"             :  cmd = cmdTERMINOLOGY_LIST_Delete             (con);  break;
				case "SPTERMINOLOGY_LIST_INSERT"             :  cmd = cmdTERMINOLOGY_LIST_Insert             (con);  break;
				case "SPTERMINOLOGY_LIST_MOVEDOWN"           :  cmd = cmdTERMINOLOGY_LIST_MoveDown           (con);  break;
				case "SPTERMINOLOGY_LIST_MOVEUP"             :  cmd = cmdTERMINOLOGY_LIST_MoveUp             (con);  break;
				case "SPTERMINOLOGY_MASSDELETE"              :  cmd = cmdTERMINOLOGY_MassDelete              (con);  break;
				case "SPTERMINOLOGY_UPDATE"                  :  cmd = cmdTERMINOLOGY_Update                  (con);  break;
				case "SPTHREADS_DELETE"                      :  cmd = cmdTHREADS_Delete                      (con);  break;
				case "SPTHREADS_INCREMENTVIEWCOUNT"          :  cmd = cmdTHREADS_IncrementViewCount          (con);  break;
				case "SPTHREADS_UPDATE"                      :  cmd = cmdTHREADS_Update                      (con);  break;
				case "SPTHREADS_UPDATEPOSTCOUNT"             :  cmd = cmdTHREADS_UpdatePostCount             (con);  break;
				case "SPTIME_PERIODS_DELETE"                 :  cmd = cmdTIME_PERIODS_Delete                 (con);  break;
				case "SPTIME_PERIODS_UPDATE"                 :  cmd = cmdTIME_PERIODS_Update                 (con);  break;
				case "SPTIMEZONES_DELETE"                    :  cmd = cmdTIMEZONES_Delete                    (con);  break;
				case "SPTIMEZONES_INSERTONLY"                :  cmd = cmdTIMEZONES_InsertOnly                (con);  break;
				case "SPTIMEZONES_UPDATE"                    :  cmd = cmdTIMEZONES_Update                    (con);  break;
				case "SPTIMEZONES_UPDATEBYNAME"              :  cmd = cmdTIMEZONES_UpdateByName              (con);  break;
				case "SPTRACKER_DELETE"                      :  cmd = cmdTRACKER_Delete                      (con);  break;
				case "SPTRACKER_UPDATE"                      :  cmd = cmdTRACKER_Update                      (con);  break;
				case "SPUSER_PREFERENCES_DELETE"             :  cmd = cmdUSER_PREFERENCES_Delete             (con);  break;
				case "SPUSER_PREFERENCES_DELETEBYUSER"       :  cmd = cmdUSER_PREFERENCES_DeleteByUser       (con);  break;
				case "SPUSER_PREFERENCES_INITPOINTER"        :  cmd = cmdUSER_PREFERENCES_InitPointer        (con);  break;
				case "SPUSER_PREFERENCES_INSERT"             :  cmd = cmdUSER_PREFERENCES_Insert             (con);  break;
				case "SPUSER_PREFERENCES_INSERTBYUSER"       :  cmd = cmdUSER_PREFERENCES_InsertByUser       (con);  break;
				case "SPUSER_PREFERENCES_READOFFSET"         :  cmd = cmdUSER_PREFERENCES_ReadOffset         (con);  break;
				case "SPUSER_PREFERENCES_WRITEOFFSET"        :  cmd = cmdUSER_PREFERENCES_WriteOffset        (con);  break;
				case "SPUSERS_ACL_ROLES_MASSUPDATE"          :  cmd = cmdUSERS_ACL_ROLES_MassUpdate          (con);  break;
				case "SPUSERS_DELETE"                        :  cmd = cmdUSERS_Delete                        (con);  break;
				case "SPUSERS_FEEDS_DELETE"                  :  cmd = cmdUSERS_FEEDS_Delete                  (con);  break;
				case "SPUSERS_FEEDS_UPDATE"                  :  cmd = cmdUSERS_FEEDS_Update                  (con);  break;
				case "SPUSERS_INSERTNTLM"                    :  cmd = cmdUSERS_InsertNTLM                    (con);  break;
				case "SPUSERS_LAST_IMPORT_DELETE"            :  cmd = cmdUSERS_LAST_IMPORT_Delete            (con);  break;
				case "SPUSERS_LAST_IMPORT_UPDATE"            :  cmd = cmdUSERS_LAST_IMPORT_Update            (con);  break;
				case "SPUSERS_MASSDELETE"                    :  cmd = cmdUSERS_MassDelete                    (con);  break;
				case "SPUSERS_PASSWORDUPDATE"                :  cmd = cmdUSERS_PasswordUpdate                (con);  break;
				case "SPUSERS_PREFERENCESUPDATE"             :  cmd = cmdUSERS_PreferencesUpdate             (con);  break;
				case "SPUSERS_SIGNATURES_DELETE"             :  cmd = cmdUSERS_SIGNATURES_Delete             (con);  break;
				case "SPUSERS_SIGNATURES_UPDATE"             :  cmd = cmdUSERS_SIGNATURES_Update             (con);  break;
				case "SPUSERS_TEAM_MEMBERSHIPS_MASSUPDATE"   :  cmd = cmdUSERS_TEAM_MEMBERSHIPS_MassUpdate   (con);  break;
				case "SPUSERS_UPDATE"                        :  cmd = cmdUSERS_Update                        (con);  break;
				case "SPVCALS_DELETE"                        :  cmd = cmdVCALS_Delete                        (con);  break;
				case "SPVCALS_UPDATE"                        :  cmd = cmdVCALS_Update                        (con);  break;
				case "SPVERSIONS_DELETE"                     :  cmd = cmdVERSIONS_Delete                     (con);  break;
				case "SPVERSIONS_UPDATE"                     :  cmd = cmdVERSIONS_Update                     (con);  break;
				case "SPWORKFLOW_EVENTS_DELETE"              :  cmd = cmdWORKFLOW_EVENTS_Delete              (con);  break;
				case "SPWORKFLOW_EVENTS_PROCESSALL"          :  cmd = cmdWORKFLOW_EVENTS_ProcessAll          (con);  break;
				default:  throw(new Exception("Unknown stored procedure " + sProcedureName));
			}
			return cmd;
		}
		#endregion

	}
}
